Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

language code is JAVA . We are implementing a Maze game that will contain multiple maze rooms. We will create an abstract MazeRoom class to

language code is JAVA . We are implementing a Maze game that will contain multiple maze rooms. We will create an abstract MazeRoom class to be the superclass of a hierarchy of different maze rooms. Such a room could contain a variety of methods and fields such as a description() method that returns a string, briefly describing the room. Rooms could also contain a variety of objects, but for simplicity lets focus on doors. Any given room will contain a List of MazeDoors, which is going to be an abstract superclass for a hierarchy of doors. There will be different types of doors and new types could be conceived as the designers of the game come up with new crazy ideas. For now we know that there will be simple doors which dont have a lock, but there will also be locked doors, and to unlock them you must provide a numeric code (integer) or a password (string). And we also know there will be doors with quizzes printed on them and the solution to the quiz (lets for simplicity say it will be a string) will need to be provided to unlock the door. The doors with quizzes will need to include a functionality to show the quiz. In the case of the doors without quizzes the answer will be hidden in other parts of the room. There will also be many type of rooms, for now we have wooden rooms which will contain normal doors, there will be steel rooms which will contain locked doors that open with numeric code, there will be brick rooms which will contain locked doors that open with a password (string) and there will be glass rooms which will contain doors with quizzes. We dont know which other rooms and doors could be created in the future thus we want to make our design as flexible as possible using the Factory Method pattern. The idea is that each subclass in the rooms hierarchy will know what type of doors it will contain and will be able to create them through a createDoor() method. With the provided information design and implement class hierarchies for the rooms and doors. Rooms should be able to create their own type of doors in the constructor given the information of where to put them. Doors need to provide the functionality to open, unlock and show the quiz. As you may notice, you have only been given very general information about the game and what design decisions to make. Feel free to incorporate your own design decision and elements to the game as you see fit.

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

More Books

Students also viewed these Databases questions