Question
#includeint main() { clrscr(); int floors = 6, rooms = 20, suites = 120, occupied = 0, totalRooms = 120, totalOccupied = 0, totalUnoccupied = 0, numFloors=16; int occupRate; //store hotel occupancy rate for (int floor = 10; floor <= numFloors; floor++) //initiate loop { if (floor==13) { floor=14; } cout << "Enter the number of rooms occupied on " << floor << "floor. "; cin >> occupied; while(occupied>20 | occupied<0) { cout<<"Invalid Entry "; cout << "Enter the number of rooms occupied on " << floor << "floor. "; cin >> occupied; } totalOccupied += occupied; //number of rooms in each floor will be added to totalRooms totalUnoccupied = totalRooms - totalOccupied; //store total of unoccupied rooms in hotel } occupRate=(totalOccupied*100)/totalRoo
Explanation / Answer
#include using namespace std; int main() { int floors = 6, rooms = 20, suites = 120, occupied = 0, totalRooms = 0, totalOccupied = 0, totalUnoccupied = 0; double occupRate=0.0; //store hotel occupancy rate for (int floor = 10; floor