Question: Write a program that calculates the occupancy rate for a hotel. The program should start by asking the user how many floors the hotel has.
Write a program that calculates the occupancy rate for a hotel. The program should start by asking the user how many floors the hotel has. A loop should then iterate once for each floor. In each iteration, the loop should ask the user for the number of rooms on the floor and how many of them are occupied. The program should output a file called HotelReport.txt and it should display neatly
How many rooms the hotel has.
How many rooms per floor are occupied and not occupied.
The total over all rooms that are occupied and not occupied.
The total percentage of rooms that are occupied. The percentage may be calculated by dividing the total number of rooms occupied by the total number of rooms.
Also include data validation. Such data validation examples are but not limited to when entering the number of rooms or how many are occupied negative number should not be allowed. In addition, if the user enters a negative number the program should not allow the user to proceed until the data is correct.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
