Problem Set #2: Java Class Design

During this prefect session, we will try to design some classes from bottom-up.

  • Design a Room class. Suppose we only knew very few characteristics of a Room such as how many people live there, if it's a single or double, and so on. Write the code for this Room class and "test" this class by instanting some Room objects and printing some pretty information about each Room object.

  • Next, design a Floor class. Suppose a Floor holds a specific number of rooms. Think about other information a Floor can store. Write some "test" code for the Floor class.

  • Finally, write a Building class. A Building consists of a certain number of floors.