Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

-There will be three java files: Room class, Dungeon class, Main method(tester file) -Please make sure it compiles Room Room description: String north: Room east:

-There will be three java files: Room class, Dungeon class, Main method(tester file)

-Please make sure it compiles

imageimageimageimageimageimageimage

Room Room description: String north: Room east: Room west: Room south: Room < > Room (description: String) + setNorth (north: Room) + setEast (east:Room) + setWest (west:Room) + setSouth(south:Room) + setExits(n: Room, e:Room, w: Room, s:Room) + getNorth(): Room getEast(): Room getwest(): Room + getSouth(): Room + getDescription(): String +getExits(): String toString(): String UML class diagram for Room Dungeon Dungeon balcony: Room bedroom1: Room bedroom2: Room dining: Room kitchen: Room northHall: Room southHall: Room < > Dungeon() +getRoom@(): Room Room Class Rooms are responsible for representing an area in the dungeon. The properties that define a room are its description and its exits. The room description may be stored using a String. For the exits, this room can hold references to other rooms that connect to it. The room constructor only sets up its description leaving its exits initially null. Client code can then update the room's properties with getter and setter methods. It would be convenient to also have a method that can set all 4 exits at once. The room's description shouldn't say its exits; instead have a method (getExits) that creates a String of exits. The toString method should contain the description and the exits. Dungeon Class The dungeon is responsible for setting up all the rooms and establishing the connections between them. The dungeon's properties (i.e. instance variables) are the rooms that it contains. The dungeon constructor should initialize all of the rooms' descriptions and its exits. The only method that our dungeon needs is to provide the starting room. Once we have the starting room we can navigate to any other room from using the rooms themselves.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

For Room public class Room private String name private String description private Room north private ... 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

Intermediate Microeconomics

Authors: Hal R. Varian

9th edition

978-0393123975, 393123979, 393123960, 978-0393919677, 393919676, 978-0393123968

More Books

Students also viewed these Programming questions