15-100:
Introductory/Intermediate Programming
(Section F) |
Fall 2006 |
Relevant Reading:
Assignment: (worth 10 exercise points) Use the files in the folder of ex10-27.zip file as your basis for this assignment. Notes:
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:
|