15-100: Introductory/Intermediate Programming (Section F)
Fall 2006
Exercise   
10/27/2006
Rooms and Temperatures
Due:  Thursday, November 2
8am

Relevant Reading:

  • Chapters 1-4 of Head First Java

Assignment:  (worth 10 exercise points)

Use the files in the folder of ex10-27.zip file as your basis for this assignment. 

Notes: 
  • I suggest that you do each of the following questions in order.
  • Be sure to add documentation to these. 
  • Also, anything that can be declared private should be declared private.
  • This exercise is intended to take approximately an hour.  If it takes you longer, you might want to seek help during Scott's office hours or assistant help hours.


1)  Look at the Application1 class as well as the Room class.   Your task is to complete the Room class so that the Application1 class does what it is supposed to.

When a room label is specified to a constructor, the word Room is appended to the end.
Rooms are assumed to have 3 bookshelves if it is not specified otherwise.

Expected output:
Our rooms:
Smith Room, with 3 shelves.
Jones Memorial Study Room, with 5 shelves.
Scott's hideout Room, with 10 shelves.




2) Now, look at the Application2 class.   Note that the Room class is the same file that you worked on for question 1.    Your task is to add to the Room class so that the Application2 class does what it is supposed to.

Expected output:
Our rooms:
Smith Room, with 3 shelves.
Jones Memorial Study Room, with 5 shelves.
Scott's hideout Room, with 10 shelves.

Our rooms after some changes:
Smith BallRoom, with 4 shelves.
Jones Memorial Study Room, with 7 shelves.
Scott's secret hideout, with 14 shelves.



3) Now, look at the Application3 class.   Note that the Room class is the same file that you worked on for questions 1 and 2.    Your task is to add to the Room class so that the Application3 class does what it is supposed to.

Note that rooms are assumed to have a thermostat at 68 degrees unless indicated otherwise.
If you don't know how to convert Fahrenheit to Celsius, you will have to look it up.

Our rooms:
Smith Room, with 3 shelves.
Jones Memorial Study Room, with 5 shelves.
Scott's hideout Room, with 10 shelves.

Our room thermostats:
Smith Room, set at 68 degrees Fahrenheit
Jones Memorial Study Room, set at 68 degrees Fahrenheit
Scott's hideout Room, set at 68 degrees Fahrenheit

Report Celsius.
Smith Room, set at 20.0 degrees Celsius
Jones Memorial Study Room, set at 20.0 degrees Celsius
Scott's hideout Room, set at 20.0 degrees Celsius
Change thermostats:

Our room thermostats:
Smith Room, set at 78 degrees Fahrenheit
Jones Memorial Study Room, set at 60 degrees Fahrenheit
Scott's hideout Room, set at 32 degrees Fahrenheit

Report Celsius.
Smith Room, set at 25.555555555555557 degrees Celsius
Jones Memorial Study Room, set at 15.555555555555557 degrees Celsius
Scott's hideout Room, set at 0.0 degrees Celsius

4)  Create  text file called "vocab.txt" and include it in your folder.  Answer the following questions in that file.

a)  Give a list of all of the accesssors in the Room class.
b)  Give a list of all of the mutators in the Room class.
c)  Give a list of all of the fields in the Room class.
d)  How many constructors are there in the Room class?
e)  Are there any examples of overloading in the Room class?
f)  Are there any examples of overriding in the Room class?


Handin:
  • Be sure to read the general handin instructions on the exercises page.
  • Rename the folder containing all of the files to be "lastname-firstname-100SectionLetter-rooms".   For example, if I were in Section Z, I would rename my folder to be:  "McElfresh-Scott-100Z-rooms"  (without the quotes).   
  • Create a zip file of this folder, with the same name as the folder (except with the .zip ending this time). Instructions for zipping can be found in the system and software handouts linked on the main course page.
  • Submit this file via the electronic handin.  If you have problems, contact me.