Room - } /** * What is the Room's description? */ public...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/** * Class to model a room in a maze. */ public class Room { p //Attributes private String description; private boolean occupied; //Constructor /** * Creates a Room in a maze with name and description. */ public Room (String description) { this.description = description; this.occupied = false; } //Qeuries /** * Represent a room as a String. */ public String toString () { return "Room " + description + "; occupied " + occupied;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } /** * What is the Room's description? */ public String roomDescription() {return description;} /** * Is the room occupied? */ public boolean occupied() {return occupied;} //Commands /** * Explorer enters the room. */ public void enter() {occupied = true;} /** * Explorer exits the room. */ public void exit() {occupied = false;} }...
View Full Document

This document was uploaded on 10/23/2009.

Ask a homework question - tutors are online