Directions, Write a program that calculates the occupancy rate of the 120 suites
ID: 3533845 • Letter: D
Question
Directions, Write a program that calculates the occupancy rate of the 120 suites (20 per floor) located on the top 6 floors of a 15-story luxury hotel. These floors are 10-12 and 14-16 because, like many hotels, there is no 13th floor. Solve the problem by using a single loop that loops once for each floor between 10 and 16 and, on each iteration, asks the user to input the number of suites occupied on that floor. Note that when it is on the iteration for floor 13, no input should be taken. After all the iterations, the program should display how many suites the hotel has, how many of them are occupied, and what percentage of them are occupied.
This is what I have so far.....
#include<stdio.h> using namespace std; int main(void) { double floor10,floor11,floor12,floor14,floor15,floor16,totalRooms=20; double perRooms; cout<<"Enter number of rooms are occupied in floor 10 : "; cin>>floor10; if(floor10 > 0 && floor10 <=20) { cout<<"In the 10th floor , the occupied rooms of amount : " <<(floor10 * 200 ); perRooms=(floor10/totalRooms)*100; cout<<" The percentage of occupied rooms is : " <<perRooms; } else cout<<"Total rooms are 20 in each floor , so enter correctly"; cout<<" Enter number of rooms are occupied in floor 11 : "; cin>>floor11; if(floor11 > 0 && floor11 <=20) { cout<<"In the 11th floor , the occupied rooms of amount : " <<(floor11 * 200 ); perRooms=(floor11/totalRooms)*100; cout<<" The percentage of occupied rooms is : " <<perRooms; } else cout<<"Total rooms are 20 in each floor , so enter correctly"; cout<<" Enter number of rooms are occupied in floor 12 : "; cin>>floor12; if(floor12 > 0 && floor12 <=20) { cout<<"In the 12th floor , the occupied rooms of amount : " <<(floor12 * 200 ); perRooms=(floor12/totalRooms)*100; cout<<" The percentage of occupied rooms is : " <<perRooms; } else cout<<"Total rooms are 20 in each floor , so enter correctly"; cout<<" Enter number of rooms are occupied in floor 14 : "; cin>>floor14; if(floor14 > 0 && floor14 <=20) { cout<<"In the 14th floor , the occupied rooms of amount : " <<(floor14 * 200 ); perRooms=(floor14/totalRooms)*100; cout<<" The percentage of occupied rooms is : " <<perRooms; } else cout<<"Total rooms are 20 in each floor , so enter correctly"; cout<<" Enter number of rooms are occupied in floor 15 : "; cin>>floor15; if(floor15 > 0 && floor15 <=20) { cout<<"In the 15th floor , the occupied rooms of amount : " <<(floor15 * 200 ); perRooms=(floor15/totalRooms)*100; cout<<" The percentage of occupied rooms is : " <<perRooms; } else cout<<"Total rooms are 20 in each floor , so enter correctly"; cout<<" Enter number of rooms are occupied in floor 16 : "; cin>>floor16; if(floor16 > 0 && floor16 <=20) { cout<<"In the 16th floor , the occupied rooms of amount : " <<(floor16 * 200 ); perRooms=(floor16/totalRooms)*100; cout<<" The percentage of occupied rooms is : " <<perRooms; } else cout<<"Total rooms are 20 in each floor , so enter correctly"; system("pause"); }
The errors I'm getting when compiling are.................
error: expected '=', ',', ';' 'asm' or '__attribute__' before 'name space'
in function'main':
error: 'cout' undeclared (first use in this function)
note: each undeclared identifier is reported onlyonce for each fun ction it appears in
error: 'cin' undeclared (first use in this function)
Explanation / Answer
comments are not displaying the answer properly.
1)#include<iostream>
2)#include<iostream.h>
one of them will work
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.