Name:  ___________________                      February 10, 2003

Queens College - CS211                                  Instructors: Yosef Alayev, John Donath

 

Quiz #1 Version A

 

Note:   This quiz is open book/open notes.

 

Directions:  Please complete the quiz by writing valid C++ source code representing .h and .cpp files, as discussed in class.  All code in the .h file must be commented according to the guidelines mentioned for the course.  For the purposes of this quiz, the .cpp files need not be commented.  Please write your code on this sheet of paper, you may use your own paper if you need more space.  Also, please write your final answer using a pen.

 

1.  Write a .h file for a class that declares an instance of a class, Hotel.  This class should store the name of the hotel, the price for a room per night, and the price of parking spot in its garage (per day).  It should have a constructor that solicits the user to enter the information stored in the class.  It should also have two accessor functions, one for price per room, and one for the name of the hotel. (2 points)

 

2.  Write the .cpp file for the class described above (1.5 points)

 

3.  Write a program that will input 12 hotels from the user, (store them in an array).  It should then print out the name of the cheapest and most expensive hotels. (1.5 points).