Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using java Escape Room Write a program that simulates an escape room by having the user open a series of three doors randomly chosen from

Using java

image text in transcribedimage text in transcribed

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 getMenuMax() + String unlock(int option) + boolean openo + String clue + String successo A DeadboltDoor ComboDoor CodeDoor BasicDoor boolean push - boolean input + BasicDoor LockedDoor - int keyLocation - int searchOption + LockedDoor boolean bolti boolean bolt2 + DeadboltDoor - int comboValue int guess + ComboDoor char keys char code + Code Door 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 - BasicDoor 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 must unlock 3 doors to escape... You encounter a basic door. You can either push it or pull it to open. 1. Push 2. Pull 1 You push the door. Congratulations, you opened the door. You encounter a double deadbolt door, both deadbolts must be unlocked to open the door, but you can't tell if they're locked or unlocked. 1. Toggle Bolt 1 2. Toggle Bolt 2 1 You toggle the first bolt. You jiggle the door. It's locked. 1. Toggle Bolt 1 2. Toggle Bolt 2 1 You toggle the first bolt. You jiggle the door. It feels like one of the bolts is unlocked. 1. Toggle Bolt 1 2. Toggle Bolt 2 2 You toggle the second bolt. You unlocked both deadbolts and opened the door You encounter a door with a combination lock. You can spin the dial to a number 1-10. Enter a number (1-10): 5 You turn the dial to... 5 You feel resistance as you turn the dial, it must be lower. Enter a number (1-10): 2 You turn the dial to... 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

What is a limited liability company?

Answered: 1 week ago