Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
6th Edition
ISBN: 9780134477367
Author: David J. Barnes, Michael Kolling
Publisher: PEARSON
Question
Book Icon
Chapter 8, Problem 23E
Program Plan Intro

Program plan:

The variables used in the program are as follows:

  1. currentRoom: stores the current room of the player.
  2. previousRoom: stores the previous room of the player.

The methods used in the program are as follows:

  1. goRoom(String direction): updates the current room of the player based on the specified direction.
  2. back(): updates the current room of the player to the previous room.
  3. processCommand(Command command): processes the given command and updates the game state accordingly.
  4. printLocationInfo(): prints out the current room's description and the items in the room.

Program Description:

To implement the back command that takes the player into the previous room where he/she was in.

Blurred answer
Students have asked these similar questions
Implement the "Add player" menu option. Prompt the user for a new player's jersey number and rating. Append the values to the two vectors. Ex: Enter a new player's jersey number: 49 Enter the player's rating: 8
Implement the "Replace player" menu option. Prompt the user for the jersey number of the player to replace. If the player is in the roster, then prompt again for a new jersey number and rating. Update the replaced player's jersey number and rating.Ex: Enter a jersey number: 4 Enter a new jersey number: 12 Enter a rating for the new player: 8
6.  You are writing a game's weapon-spawning system. The weapon that's spawned is completely randomized. There are a few base types of weapons, but some of these have one or more additional functions. The additional functions can apply to any of the types of weapons. Which design pattern is the most useful here?   Question options:   Adapter   Null Object   Decorator   Proxy
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education