Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java class representing the concept of Hotel Rating over a number of years. The hotel ratings are represented by a number of stars:

Write a Java class representing the concept of Hotel Rating over a number of years. The hotel ratings are represented by a number of stars: one star (lowest quality) to five stars (highest quality). The only attribute the class has is a two-dimensional array of values representing the quality ratings. Dimension 1 (rows) represents the hotels and dimension 2 (columns) represents the years. Write the following class methods:

A constructor method that takes two parameters representing the number of hotels and the number of years. The ratings are randomly generated and stored in the array.

Method bestHotel that returns an array of 2 elements holding the index for the best quality hotel over the years and the index for the worst quality hotel over the years.

Method printChart that prints a rating chart for all hotels similar to the following sample output (just for illustration, assume we have 3 hotels and 4 years of ratings):

Hotel 0: ** *** **** ***

Hotel 1: *** *** ** **

Hotel 2: ***** **** **** *****

Write a test program to create an object of the class and test all of the class methods on that objects.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions