Reference no: EM13167945
Write a class and client class that stores hotels ratings over the years. The number of stars represents hotel ratings. Use a two dimensional integer array to represent the years and hotels. The columns can represent the years and the rows the hotels. Each element of the 2-dimensional array stores an integer value between 1 - 5, which represents the number of "stars" this hotel has. You can initialize the 2-dim array at the beginning of your program.
In addition, declare a one dimensional String array that stores the names of the hotels and each location corresponds to the hotel in each row of the 2-dim array. Define another String array containing the years.
For example:
String hotels = {"Best Value", "Western Inn"};
String years = { "2005", "2006", "2007", "2008"};
Hotels location zero (hotels [0]) corresponds to array[0][0]
Your program should output for each hotel and each year the number of stars received.
Use the asterisk "*" symbol to indicate the number of stars earned.
For example:
2005 2006 2007 2008
Best Value ***** *** **** **
Western Inn *** * *** *****
You need to create three nested loops.
For(int m=0; m< hotels.length; m++)
{
For(col=0; col<array[m].length;col++)
{
For(i=0; i<=array[m][col]; i++)
{ //print the asterisk}
//print a tab before getting the new value for the hotel stars