Question: I keep getting these error messages for my c++ program: expected ' ; ' before ' { ' token expected ' ; ' before 'cout'

I keep getting these error messages for my c++ program:

expected ' ; ' before ' { ' token

expected ' ; ' before 'cout'

// This is a program that calculates the occupancy rate for a hotel

#include #include #include

using namespace std;

int main() {

int floor = 1; // Number of floors hotel has int floorNumber = 1; // Level of floor int room = 10; // Number of rooms on each floor int occupiedRoom = 0; // Number of occupied rooms float occupancyRate; // Occupancy rate of the hotel

cout << "This program will calculate the occupancy rate for the hotel. First we need some information about the hotel. " << endl; cout << "**************************************************************************************************************" << endl;

cout << "How many floors does this hotel have?" << endl; // Ask user how many floors cin >> floor; // User's value of floor

if (floor < 1)

{ cout << "Zero or negative numbers are not allowed. Please enter a positive value. " << endl; // Input Invalidation cin >> floor; // User's value of floor }

else (floor >= 1) { cout << "Pick a floor number using numbers 1, 2, 3, ... " << endl; // Ask user to choose a floor cin >> floorNumber; // User's value of floor level }

if (floorNumber < 1) { cout << "Zero or negative numbers are not allowed. Please enter a positive value. " << endl; // Input Invalidation cin>> floorNumber; // User's value of floor level }

else (floorNumber >= 1) { cout << "How many rooms does this floor have?" << endl; // Ask user how may rooms the floor has cin >> room; // User's value of the number of rooms the floor has }

if (room < 10) { cout << "Zero or negative numbers are not allowed. The number of rooms has to be at least 10. " cout << "Please enter a positive value or a number greater than or equal to 10. " << endl; // Input Invalidation cin >> room; // User's value of the number of rooms the floor has }

else (room >= 10) { cout << "How many rooms on this floor are occupied?" << endl; // Ask user how many rooms on this floor are occupied cin >> occupiedRoom; //User's value of occupied rooms on this floor }

if (occupiedRoom < 1) { cout << "Zero or negative numbers are not allowed. Please enter a positive value. " << endl; // Input Invalidation cin >> occupiedRoom; // User's value of occupied rooms on this floor }

else (occupiedRoom >= 0) { occupancyRate = occupiedRoom / room; cout << "The occupancy rate for this hotel is " << occupancyRate << "%" << endl; cout << "" << endl; cout << "Thank you for using the Occupancy Rate Calculating Program! Goodbye. " << endl; }

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!