Question: Write a test program in a separate file, named TestHotelRating, to create an object of the class and test all seven class methods on that

Write a test program in a separate file, named TestHotelRating, to create an object of the class and test all seven class methods on that object following the sample run below. Allow the user to enter both number of years and number of hotels. Do not hard-code the array size. Use a sentinel loop to allow re-runs and re-create the object with different input values. Document your code, organize, and space the outputs properly. Use escape characteristics and formatting objects ($ and %) as needed. The following sample test shows only the output labels and format (assuming three hotels and four years for illustration purpose). Make sure your code displays the outputs following the test data format. Test data: Five stars hotels indices: 0,2 Average Ratings are: Hotel 0: 3.25 Hotel 1: 2.25 Hotel 2: 4.50 Four or more stars hotels indices: 0,2 Any five stars hotel? true Best hotel index: 2 Worst hotel index: 1 Page 2 of 2 Ratings chart: Year1 Year2 Year3 Year4------------------------------------------------------------------------------------------------- Hotel 0: ************* Hotel 1: ********** Hotel 2: ****************** Would you like to run the program again (y/n)? y

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!