
Concept explainers
For this assignment, you will be building a class, creating objects, doing comparisons and using nested control statements. You need to remember what you have learned in class, lab, books and your assignments. Be sure to refer to them when you need to.
There are 2 parts to this assignment. In the first part, you are going to be given a problem and you will then need to create a structure, write
So let’s get started!
Part 1: Your haunted house adventure:
The user always starts the game at the front door and must immediately decide where they want to go. Your movement constraints are as follows:
-From the front door, the user must choose between going into the living room, dining room or up the stairs.
-To get from one room to the next, there must be a door. That means that to get to some rooms, the user must go through other rooms. See the above diagram for more details.
-If the user is in a room that is attached to another room via a door (not the one they just came in—no backtracking!), the user must be given the option between going to the other room or exploring an item in the current room.
-If the user is in a room that has no other exit, then they must be given the option between exploring the items in the room.
-The user will have a backpack that contains the item they’ve collected during their journey.
-The backpack does NOT have to be an array.
-The backpack can be a simple string, which can contain the item that a user has.
-Use the contains method on the string that is acting as the user’s inventory to find out what item(s) they currently contain.
e.g. inventory.contains(“string”) will return true if the word “string” is anywhere within the string inventory.
Possible rooms to explore:
Floor |
Room |
Item(s) |
Outcome |
1 |
Living Room |
Chest |
Ghost escapes and scares you to death |
1 |
Dining Room |
Candelabra |
Light up by themselves and see a death shadow |
1 |
Kitchen |
Refrigerator |
Open it and find some delicious soul food |
1 |
Kitchen |
Cabinet |
The dishes and glasses start flying at you as soon as you open the door. You get hit in the head and feel yourself start moving towards a light |
1 |
Pantry |
Dusty recipe box |
You open it up and a recipe for chocolate devils food cake appears our of no where |
1 |
Pantry |
Broom |
Flies up in the air as soon as you touch it |
1 |
Bathroom |
Mirror |
See a bloody face looking back at you |
1 |
Bathroom |
Shower |
Room suddenly steams up and you feel fingers touching the back of your neck |
2 |
Bedroom 1 |
Rocking Chair |
Chair starts rocking by itself with no one in it |
2 |
Bedroom 1 |
Window |
See a child outside on a swing who suddenly disappears |
2 |
Bedroom 2 |
Doll House |
The dolls start dancing on their own |
2 |
Bedroom 2 |
Dresser |
A ghost flies out of the dresser as soon as you open it and goes right though your body |
2 |
Master Bedroom |
Jewelry Box |
You find the cursed Hope Diamond and feel your doom |
2 |
Master Bathroom |
Intricate Oil Lamp |
Rub the lamp and a genie pops out who says he’ll grant you 3 wishes |
2 |
Master Bathroom |
Shower |
Suddenly hear singing in the shower, but no one is there |
2 |
Bathroom |
Mirror |
See a bloody face looking back at you |
2 |
Bathroom |
Shower |
Room suddenly steams up and you feel fingers touching the back of your neck |
Program Flow:
-Ask the user to enter their name so that you can personalize their experience. You will want to use their name as they move through the house and make decisions
-Start at the front door as described above.
-Each time the user moves to a new room, you must then ask the user what he or she wants to do next. The options available are derived above. Note that there are sometimes more that 2 options available.
-Should the user reach a room where there is no other exit, they must select an object to explore.
-Once the object is explored, it must be put into the backpack. The game is over. This should be indicated clearly to the user (and have fun!).
Input/Output Requirements:
-Welcome the user to the game. Be sure to include their name in your welcome message.
-Using ascii art or graphics, print out an image showing where in the house the user is starting.
-For each step, present the users with their options and ask them what they want to do (hint: put word options in quotes to indicate what they should type in to respond to your question)
-Once they have selected an object to explore, be sure to print out their final outcome, including telling them what item they have in their backpack.
-At the end of the game, using ascii art or graphics, print out an image showing where in the house the user ended the game.
Program Structure Requirements:
-For your class structure, you must use classes, objects and methods.
-Do NOT just use a huge series of sequential if statements, nested if statements or switch statements for your program flow


Trending nowThis is a popular solution!
Step by stepSolved in 10 steps with 2 images

- In c++ Create a new project named lab11_1. You will be implementing three classes: A Clothing class, a Shirt class, derived from Clothing and third class of your choice that will be derived from Clothing. I have included the UML diagrams for Clothing and Shirt. You will need to make sure that the class you derive from Clothing is appropriate, meaning it makes sense that it would inherit from Clothing. In your driver file, I’d like to see a Shirt object created, as well as an object of the class type that you create. Set the class variable members to specific values, and then print. You can choose to override the output operator to make this easier, or you can implement a method named print(). Create a new project named lab11_2. Come up with your own base class, and derived class. No big specifications here on what you need to do (in terms of overloading operators, friend functions, static variables, composition, etc), but you have to make use of the base class members in the derived…arrow_forwardJava is an OO language, which means that it focuses on objects. The existence of material things is generally accepted. You, as a student of computer science, have been tasked with differentiating between tangible items and their equivalents in object-oriented code. A project-oriented program is one that is designed with a particular end in mind.arrow_forwardThis next program is a little simpler, but it still illustrates some very critical program structures. It also illustrates an idea that is still used commonly, even if the mechanism has evolved with modern tools and alternative languages. We are referring to a menu-based help system. Modern help systems and menus are often represented using an integrated user environment; however, the core concepts behind the help system remain largely unchanged from this assignment. Create an interactive help system for Java programming. The system will incorporate a menu system that interacts with the user, and the appropriate help topic will be displayed, based on an input selection. This program is going to require some research on your part, as well as some programming in Java. Specifically, you will need to find definitions for the Java terms included in your help system. You can read the textbook or scour the Internet for the definitions. They should be no more than a few sentences each; nothing…arrow_forward
- Java is an OO language, which means that it focuses on objects. The existence of material things is generally accepted. As a student of computer science, you have been tasked with differentiating between tangible items and their equivalents in object-oriented code. Project-oriented programs are those that are designed to achieve a certain end result.arrow_forwardIn order to define a variable, 'Type' is not enough. Data types and other properties are present in all variables. Is there a notion that allows us to communicate the characteristics of any variable?arrow_forwardUsing a simple drawing, describe class diagrams and their purpose. The drawing supplements the text, and the text explains the drawing.arrow_forward
- After learning the looping and input validation concepts, create a problem to give to your students to allow them to practice the looping and input validation concepts. The problem should include at least two different decision structures and a loop. The number of times to process the loop is stated in the problem definition. The decision structures should be chosen from the simple, combined, nested and CASE structures. The problem description should include: The input into the problem. The output from the problem. The generic processing necessary to solve the problem. (do not give too much information away). The solution should include: Input validation statements The solution should include the exact calculations need to solve the problemarrow_forwardComputer Science UML is a standard language that allows you to capture different aspects of your system in well-defined graphical models. Some of the models capture static aspects for the system and one will capture dynamic behavior for the system. In this project, you are required to draw an activity diagram showing the actions and events involved in depositing a check to a bank account using a mobile app. In particular, your paper should provide the following: A simple pseudo-code that captures the sequence of that process A detailed activity diagram that maps to your pseudo code you identified Make sure to specify clearly any assumptions you feel important to understand your logic I'm a bit lost on what to do and really just need an example of what this is asking and then suggestions on how to go about doing the assignment.arrow_forwardCreate a new project named lab10. You will be implementing two classes: A SolarSystem class, and a Planet class. The SolarSystem contains Planet objects stored in a vector. A UML diagram for the Solar System and Planet classes The first part you should implement is the Planet class. Don't add the SolarSystem files to the project at the beginning, just work on the Planet class. Test the different overloaded operators as we did during lecture for your Planet class, and then move on to the SolarSystem class. The SolarSystem default constructor should resize the vector to zero. The default constructor values for Planet can be whatever you’d like, but make the mass a very small number, so later on when you're looking for the largest planet, it doesn't use the default Planet value. The addPlanets() method will take a number as an argument for the number of Planets that will be in your SolarSystem. So if you call addPlanets with 5 as an argument, there will be 5 Planets to add to the…arrow_forward
- Draw the UML diagram for the class. Implement the class. Write a test program that creates an Account object with an account ID of 1122, a balance of $20,000, and an annual interest rate of 4.5%. Use the withdraw method to withdraw $2,500, use the deposit method to deposit $3,000, and print the balance, the monthly interest, and the date when this account was created.arrow_forwardMUST BE IN JAVA. PLEASE USE COMMENTS AND WRITE THE CODE IN SIMPLEST FORM.arrow_forwardOverview In this assignment, you will gain more practice with designing a program. Specifically, you will create pseudocode for a higher/lower game. This will give you practice designing a more complex program and allow you to see more of the benefits that designing before coding can offer. The higher/lower game will combine different programming constructs that you have been learning about, such as input and output, decision branching, and a loop. Higher/Lower Game DescriptionYour friend Maria has come to you and said that she has been playing the higher/lower game with her three-year-old daughter Bella. Maria tells Bella that she is thinking of a number between 1 and 10, and then Bella tries to guess the number. When Bella guesses a number, Maria tells her whether the number she is thinking of is higher or lower or if Bella guessed it. The game continues until Bella guesses the right number. As much as Maria likes playing the game with Bella, Bella is very excited to play the game…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





