Skip Top Navigation Bar

Escape Room Code Decoding

An escape maze is comprised of multiple rooms. In each room, you will find a code to lead you to the next room. The code is comprised of a word representing the mission clue, followed by a dash(-), followed by a three-digit lock code, followed by a dash(-), followed by a clearance word. There are no spaces in the code.

For example,

TIME-415-CLOCK

The lock code will tell the team to go to the next room on the right if a positive value is returned when it is compared to the master lock code or to the left if a negative value is returned when it is compared to the master lock code. If 0 is returned when it is compared to the master lock code, the team has won and can exit the game.

Team's can also win if the clearance word matches the master clearance word.

They need to know the mission clue to aid in finding the code in the next room.

You will write a program to determine whether the team can exit based on the lock code and clearance word. Regardless, you will print a report that includes:

Code Generator

Master codes are represented by the CodeGenerator.java class. A master code is generated at the start of each game. This UML diagram provides you with the constructors, attributes, and methods you have access to when writing your code.

Class Name: CodeGenerator Class
Constructors:
  • CodeGenerator()
  • CodeGenerator(int lockCode, String clearance)
Data/Attributes:
  • int lock;
  • String clearance;
Methods/Behaviors:
  • int getLockCode()
  • String getClearanceWord()

Algorithms and Planning

You will write a program to do the following:

Develop Test Cases

Before you write your code, determine a set of test master codes and room codes as well as the results. Be sure to provide tests for all scenarios:

You will want to use the default constructor for CodeGenerator when testing your code.

Develop an Algorithm

Develop algorithms to address each task in this project:

Write Your Program in an IDE

Now that you have planned out your program, it's time to write it in your IDE. You will have two .java files for this program. It is best practice to create a project folder for both of these files to be stored together.