Question: #include #include #include using namespace std; int main() { //defines an input stream for the data file ifstream inFile; //Defines an output stream for the

#include
#include
#include
using namespace std;
int main() {
//defines an input stream for the data file
ifstream inFile;
//Defines an output stream for the data file
ofstream outFile;
//Declaring variables
int floor;
int rooms;
int i = 0;
int occupied;
int unoccupied;
//Setting the precision
cout
outFile
//Opening the input file
inFile.open("hotel.txt");
//checking whether the file name is valid or not
if (inFile.fail())
{
cout
return 1;
}
//Writing the output on the console
cout
cout
cout
cout
cout
inFile >> setw(0)>>floor;
for (int i = 1; i
{
if (i == 13)
{
++i;
cout
++i;
cout
}
else {
cout
}
inFile >> rooms >> occupied >> unoccupied;
if(rooms
{
cout
}
}
inFile.close();
cout
system("Pause");
return EXIT_SUCCESS;
}
CS150 Assignment 6 Hotel Occupancy Summarizer Date assigned: Wednesday, October 24, 2018 Program due: Friday, November 2, 10:30am (35 points) You have just been hired by the Swynn Hotel in Las Vegas to help them determine their occupancy rate. The manager at Swynn would like you to print out a report that shows for each floor, the number of rooms on the floor, the number of occupied rooms, and the number of unoccupied rooms. The report must also list the total number of rooms, the total number of occupied rooms, and the total number of unoccupied rooms. Finally, the report must display the percentage of occupied rooms and the percentage of unoccupied rooms. The data that has been provided for you is in a text file named "hotel.txt" and includes a series of lines of data. The first line contains the number of floors in the hotel. This is followed by a line for each floor in the hotel containing the number of rooms, then a series of zeros or ones indicating if each room is occupied (one) or unoccupied (zero). For example, if a hotel has two floors, floor 1 has 5 rooms, 3 of which are occupied, and floor 2 has 3 rooms, none of which are occupied, then the file would look like: 5 0e 1 11 3 0 0 The hotel manager also wants your program to account for the fact that there is no 13 floor at the Swynn. Most hotels do not have a 13th floor as the number 13 is considered unlucky. Triskaidekaphobia is the fear of the number 13! Instead of a 13th floor, the Swynn goes straight from the 12th floor to the 14th floor. Notes: Read the hotel data from a file called "hotel.txt" Minimally, a data file must consist of one line containing the number zero indicating that there are no floors in this hotel. There is no input from the user in this program. All the data will be read from the input file 1. 2. 3. 4. Make sure there are no magic constants, including inside the setw. The only 5. magic constant that is allowed is 0 to initialize counters. Constants must be all in caps and constants must be declared before variables. The comment block at the top of the file must contain hours worked. 6
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
