#include <iostream>
#include <iomanip>
using namespace std;
int main( ) {
int numFloors;
int numRooms;
int numOccupied;
int totalRooms= 0 ;
int totalOccupied= 0 ;
int vacantRooms;
double occupiedPCT;
cout << "Enter number of floors in the hotel\n " ;
cin >> numFloors;
while ( numFloors < 1 )
{
cout << "Only enter number that is 1 or greater\n " ;
cin >> numFloors;
}
for ( int i = 1 ; i <= numFloors; i ++ )
{
cout << "How many rooms in the floor num " << i << endl;
cin >> numRooms;
while ( numRooms < 10 )
{
cout << "Only enter number of rooms that is 10 or greater\n " ;
cin >> numRooms;
}
cout << "How many rooms are occupied in the floor num " << i << endl;
cin >> numOccupied;
totalRooms + = numRooms;
totalOccupied + = numOccupied;
}
vacantRooms = totalRooms - totalOccupied;
occupiedPCT = ( static_cast < float > ( totalOccupied) / totalRooms) * 100 ;
cout << "Total Rooms : " << totalRooms << endl;
cout << "Total Occupied Rooms " << totalOccupied << endl;
cout << "Number of Vacant Rooms : " << vacantRooms << endl;
cout << fixed << setprecision( 2 ) ;
cout << "Percentage of Occupied Rooms is : " << occupiedPCT << "%" << endl;
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW9tYW5pcD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgewoJaW50IG51bUZsb29yczsKCWludCBudW1Sb29tczsKCWludCBudW1PY2N1cGllZDsKCWludCB0b3RhbFJvb21zPTA7CglpbnQgdG90YWxPY2N1cGllZD0wOwoJaW50IHZhY2FudFJvb21zOwoJZG91YmxlIG9jY3VwaWVkUENUOwoJCgkKCWNvdXQgPDwgIkVudGVyIG51bWJlciBvZiBmbG9vcnMgaW4gdGhlIGhvdGVsXG4iOwoJY2luID4+IG51bUZsb29yczsKCXdoaWxlIChudW1GbG9vcnMgPCAxKQoJewoJCWNvdXQgPDwgIk9ubHkgZW50ZXIgbnVtYmVyIHRoYXQgaXMgMSBvciBncmVhdGVyXG4iOwoJCWNpbiA+PiBudW1GbG9vcn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