<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">/* A Room has an id number and a messiness level */
class Room {
  private static int nextID = 1; //id of next room to be 
                                 //created
  protected int id; //room number
  private int mess; //mess level

  /** A Room has unique id and messiness level mess */
  public Room(int mess) { this.mess = mess;
                          id = nextID;   nextID++; }
 
  /** = String description of this Room */
  public String toString() { return "Room " + id; }
 
  /** Reduce mess by 1 but keep mess&gt;=0 */
  public void clean() { mess--;
                        if (mess&lt;0)  mess=0; }
 
  /** Print status of Room */
  public void report() { System.out.println(toString() +
                         ", has mess level " + mess);     }
 
  /** Print how many rooms have been created */
  public static void countRooms() {
    System.out.println((nextID-1)+ " rooms in total"); }
} //class Room



</pre></body></html>