Question 4: Write the source code of the classes ReportCurrentRevenue and ReportPastIncome. The ReportCurrentRevenue class is responsible from calculating the current amount of money to be gained if all the guests would leave from the hotel. The ReportPastIncome class is responsible from calculating the money gained so far from the previous visits of guests. Class Hotel will create one instance of this class and execute it in multithreaded fashion in its report method. You will code Hotel.report in the next question. Question 5: Write the source code of only the following methods of the class Hotel. The explanations of the methods you need to code are given below. Don’t forget to address the multithreading issues when coding. report: The details of this method are given in Question 4. restore: This method loads the Hashtable members and LinkedList visits from the path given by the fileName parameter. However, if there are ongoing multithreaded operations, it must first wait them to be finished. findRoomNrOfGuest: This method returns the room number of a guest whose name is given by the method parameter. It returns 0 if no such guest e
[JAVA]
Question 4: Write the source code of the classes ReportCurrentRevenue and ReportPastIncome. The ReportCurrentRevenue class is responsible from calculating the current amount of money to be gained if all the guests would leave from the hotel. The ReportPastIncome class is responsible from calculating the money gained so far from the previous visits of guests. Class Hotel will create one instance of this class and execute it in multithreaded fashion in its report method. You will code Hotel.report in the next question.
Question 5: Write the source code of only the following methods of the class Hotel. The explanations of the methods you need to code are given below. Don’t forget to address the multithreading issues when coding.
- report: The details of this method are given in Question 4.
- restore: This method loads the Hashtable members and LinkedList visits from the path given by the fileName parameter. However, if there are ongoing multithreaded operations, it must first wait them to be finished.
- findRoomNrOfGuest: This method returns the room number of a guest whose name is given by the method parameter. It returns 0 if no such guest exists.
Step by step
Solved in 2 steps