Hotel Occupancy Write a program that calculates the occupancy rate for a hotel.
ID: 644081 • Letter: H
Question
Hotel Occupancy 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. After all the iterations, the program should display how many rooms the hotel has, how many of them are occupied, how many are unoccupied, and the percentage of rooms that are occupied. The percentage may be calculated by dividing the number of rooms occupied by the number of rooms. NOTE: it is traditional that most hotels do not have a thirteen floor. The loop in this program should skip the entire thirteen iteration. (Floor numbers: 1 , 2, 3, 4, 5, 6, 7, 8, 9, 1 0, 1 1 , 1 2, 1 4, 15, 16, ....) Input Validation: Do not accept a value less than 1 for the number of floors. Do not accept a number less than 1 0 for the number of rooms on a floor. If a person enters an invalid value, the program should keep them in a loop until the correct value is entered. On any floor, The number of rooms occupied can't be more than the total number of rooms.Explanation / Answer
//Header file section #include #include using namespace std; int main () { //variable declaration double noFloors,noRooms,occupRooms,perRooms; double totalRooms; double TotOccupRooms; //inputting total number of floors coutnoFloors; if (noFloorsRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.