Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In Java please Escape Room Write a program that simulates an escape room by having the user open a series of three doors randomly chosen
In Java please
Escape Room Write a program that simulates an escape room by having the user open a series of three doors randomly chosen from several different types of doors. Use the following class structure for your program (you must create Main, Door, and BasicDoor, plus any two other types of doors for full credit. You can then add 1 or 2 additional doors for 2 points of extra credit each (must be fully working and correct, no partial extra credit): interface Door Main + void main(String i args) + void openDoor( Door d) + int getintRange(int min, int max) + String examine) + String menu + int getMenuMaxO + String unlock(int option) + boolean open + String clue | + String successo - boolean bolti BasicDoor LockedDoor DeadboltDoor ComboDoor CodeDoor - boolean push - int keyLocation int comboValue - char keys - boolean input - int searchOption - boolean bolt2 - int guess - charl) code + BasicDoor + LockedDoor + DeadboltDoor + ComboDoor + CodeDoor Methods (the interface forces all implementing classes to override methods 1-7): 1. examine() - returns a string description of the door. 2. menu() - returns a list of options the user can do to unlock the door. 3. getMenuMax() - returns max value of the above menu (ie. for getIntRange). 4. unlock( int option ) - passes in the user's menu selection and performs the action associated with that choice in the attempt to open the door. Returns text related to the user's action. 5. open() - tests to see if the door has been unlocked, returns true if it is. 6. clue() returns a hint to help the user unlock the door if they failed at unlocking it. 7. success() - returns the success message for when the user unlocks the door. 8. OpenDoor( Door d)-passes in the door the user will try to unlock. It should call examine, then menu, get the user's input, and pass the input to the unlock method to try to open the door, if it was successful, it calls success, otherwise, it calls clue and repeats from the menu until the user successfully opens the door. The main should, in a loop that repeats three times, randomly choose one of the 3 (or 4 or 5, if you did the extra credit) possible doors and then call the openDoor method on that Door. After the user has opened all three doors, display a congratulatory message and end the game. Examples of Examine, Menu & Clues - Basic Door LockedDoor DeadboltDoor ComboDoor CodeDoor A door that A door that can be A door with two A door with a A door with a can be opened with a deadbolts. Both combination coded keypad pushed or key. Look around need to be unlocked lock. You can with three pulled. to see if you can for the door to open, spin the dial to characters. Each find it. but you can't tell if a number 1-10. key toggles a they are locked or value with X or 0. unlocked 1. Push 1. Look under mat 1. Toggle Bolt 1 Enter # 1-10: 1. Press Key 1 2. Pull 2. Look under the 2. Toggle Bolt 2 2. Press Key 2 flower pot 3. Press Key 3 3. Look under the fake rock Try the Look somewhere One is in the correct Too high. (or Number of correct other door. else. position. Too low.) items. Example Output: Welcome to the Escape Room. You encounter a double You must unlock 3 doors to deadbolt door, both deadbolts escape... must be unlocked to open the You encounter a basic door. door, but you can't tell if You can either push it or they're locked or unlocked. pull it to open. 1. Toggle Bolt i 1. Push 2. Toggle Bolt 2 1 2. Pull 1 You toggle the first bolt. You push the door. You jiggle the door. It's Congratulations, you opened locked. the door. 1. Toggle Bolt i 2. Toggle Bolt 2 You encounter a door with a 1 combination lock. You toggle the first bolt. You can spin the dial to a You jiggle the door. It feels number 1-10. like one of the bolts is Enter a number (1-10): 5 unlocked. You turn the dial to... 5 1. Toggle Bolt i You feel resistance as you 2. Toggle Bolt 2 turn the dial, it must be 2 lower. You toggle the second bolt. Enter a number (1-10): 2 You unlocked both deadbolts You turn the dial to... 2 and opened the door You feel resistance as you turn the dial, it must be Congratulations! You lower. escaped...this time. Enter a number (1-10): 1 You turn the dial to... 1 You found the right value and opened the doorStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started