Newatprogramming
Technical User
I am learning C++ and I have written this simple project. I have no clue if it will function, because I cannot even get it to compile. I continually keep getting a fatal error of unexpected end of file.
Hopefully someone will look at my program, and maybe guide me in the right direction.
#include <iostream.h>
#include <iomanip.h>
int main()
{
char roomType= 0,response, regResponse, bedResponse, gymResponse, exitSystem;
int daysGueststay, roomRate, gymFee;
bool extraBed, usesGym, regCompleted, exitRegistration;
cout<< setiosflags(ios::fixed)
<< setiosflags(ios::showpoint)
<< setprecision(2);
// The following statement is for the Hotel reservation specialist
cout<< "\nWelcome to the Ritz Carlton reservation request system ";
cout<< "\nThe following are our room rates and amentity prices ";
cout<<endl;
cout<< "Garden View $125.00 per day "<<endl;
cout<< "Pool View $145.00 per day "<<endl;
cout<< "Lake View $180.00 per day "<<endl;
cout<<endl;
cout<< " ** The following fees are in addition to the room fee "<<endl;
cout<<endl;
cout<< "extra bed $15.00 per day for the Garden and Pool view rooms "<<endl;
cout<< "extra bed $20.00 per day for the Lake view rooms "<<endl;
cout<< "Gym use fee $ 5.00 per day "<<endl;
cout<<endl;
cout<< "A contential breakfast is complementary to all guests!!! "<<endl;
cout<<endl;
cout<< "All room prices are subject to change without notice "<<endl;
cout<<endl;
do
{
// This menu will display the room type
int rateLake = 180, ratePool = 145, rateGarden = 125;
cout<< "\nG. Garden View"<<endl;
cout<< "P. Pool View"<<endl;
cout<< "L. Lake View"<<endl;
cout<< "Q. Quit"<<endl;
cout<< "\n Please enter a room type: "; // Prompt user to enter a room type
cin >>roomType; // Get input from person making the reservation
cout<<endl;
switch (roomType)
{
case 'G':
cout<<" \nYou have entered a request for the Garden View room"<<endl;
break;
case 'P':
cout<<" \nYou have entered a request for the Pool View room "<<endl;
break;
case 'L':
cout<<" \nYou have entered a request for the Lake View room"<<endl;
break;
case 'Q':
case 'q':
cout<<" You are exiting the reservation request system "<<endl;
break;
default:
cout<<"\nYou have made an invalid entry "<<endl;
break;
}
cout<<endl;
cout<<" Does the guest need an extra bed: y/n"<<endl;
cin>>bedResponse;
if (bedResponse == 'n' || bedResponse == 'N' && roomType == 'Q' || roomType == 'q')
{ extraBed = false;
cout<< " A guest bed will not be added to the room rate"<<endl;
break;
}
if (bedResponse == 'y' || bedResponse == 'Y' && roomType == 'L' || roomType == 'l')
{ rateLake += 20;
rateLake = roomRate;
cout<<rateLake<<endl;
}
else if (bedResponse == 'y'|| bedResponse == 'Y' && roomType == 'P' || roomType == 'p')
{ ratePool += 15;
ratePool = roomRate;
cout<<ratePool<<endl;
}
else if (bedResponse == 'y'|| bedResponse == 'Y' && roomType == 'G' || roomType == 'g')
{ rateGarden += 15;
rateGarden = roomRate;
cout<<rateGarden<<endl;
}
else
{
cout<<"\nYou have entered an invalid response. Please Re-enter. "<<endl;
cout<<" Does the guest want to use to the Gym facilities: y/n"<<endl;
cin>>gymResponse;
if ( roomType == 'Q' || roomType == 'q')
break;
if (gymResponse == 'Y' || gymResponse == 'y')
{ usesGym = true;
cout<< "\nThe guest has requested to use the Gym";
cout<< "An additonal $ 5.00 per day charge will be added to the room rate ";
}
else if (gymResponse == 'n' || gymResponse == 'N')
cout<<" The guest does not wish to use the Gym facilities ";
else
cout<<"\nYou have entered an invalid response. Please Re-enter. "<<endl;
if ( roomType == 'Q' || roomType == 'q')
break;
if (usesGym == true)
{ gymFee += 5;
}
cout<<" Has the guest completed the reservation request and ready to check-in: y/n ";
cin>>regResponse;
if ( roomType == 'Q' || roomType == 'q')
break;
if (regResponse == 'y' || regResponse == 'Y')
{ regCompleted = true;
cout<<"\nPlease wait as the registration system totals the room charges "<<endl;
}
cout<<endl;
cout<< " The charge per night for the "<<roomType<<" $ "<<roomRate<<endl;
cout<< "Total nights stay :"<<daysGueststay<<endl;
cout<< "Total charge is: "<<daysGueststay * roomRate + gymFee<<endl;
cout<<endl;
}
while(roomType != 'Q' || roomType != 'q'); // End of Loop
cout << "\n Thank You for using the Ritz Carlton Reservation System "<<endl;
cout<<endl;
return 0;
}
Compiling...
version 1.cpp
C:\IS Dept Classes\Is-343\hello\Project Ritz\version 1.cpp(175) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
version 1.exe - 1 error(s), 0 warning(s)
Hopefully someone will look at my program, and maybe guide me in the right direction.
#include <iostream.h>
#include <iomanip.h>
int main()
{
char roomType= 0,response, regResponse, bedResponse, gymResponse, exitSystem;
int daysGueststay, roomRate, gymFee;
bool extraBed, usesGym, regCompleted, exitRegistration;
cout<< setiosflags(ios::fixed)
<< setiosflags(ios::showpoint)
<< setprecision(2);
// The following statement is for the Hotel reservation specialist
cout<< "\nWelcome to the Ritz Carlton reservation request system ";
cout<< "\nThe following are our room rates and amentity prices ";
cout<<endl;
cout<< "Garden View $125.00 per day "<<endl;
cout<< "Pool View $145.00 per day "<<endl;
cout<< "Lake View $180.00 per day "<<endl;
cout<<endl;
cout<< " ** The following fees are in addition to the room fee "<<endl;
cout<<endl;
cout<< "extra bed $15.00 per day for the Garden and Pool view rooms "<<endl;
cout<< "extra bed $20.00 per day for the Lake view rooms "<<endl;
cout<< "Gym use fee $ 5.00 per day "<<endl;
cout<<endl;
cout<< "A contential breakfast is complementary to all guests!!! "<<endl;
cout<<endl;
cout<< "All room prices are subject to change without notice "<<endl;
cout<<endl;
do
{
// This menu will display the room type
int rateLake = 180, ratePool = 145, rateGarden = 125;
cout<< "\nG. Garden View"<<endl;
cout<< "P. Pool View"<<endl;
cout<< "L. Lake View"<<endl;
cout<< "Q. Quit"<<endl;
cout<< "\n Please enter a room type: "; // Prompt user to enter a room type
cin >>roomType; // Get input from person making the reservation
cout<<endl;
switch (roomType)
{
case 'G':
cout<<" \nYou have entered a request for the Garden View room"<<endl;
break;
case 'P':
cout<<" \nYou have entered a request for the Pool View room "<<endl;
break;
case 'L':
cout<<" \nYou have entered a request for the Lake View room"<<endl;
break;
case 'Q':
case 'q':
cout<<" You are exiting the reservation request system "<<endl;
break;
default:
cout<<"\nYou have made an invalid entry "<<endl;
break;
}
cout<<endl;
cout<<" Does the guest need an extra bed: y/n"<<endl;
cin>>bedResponse;
if (bedResponse == 'n' || bedResponse == 'N' && roomType == 'Q' || roomType == 'q')
{ extraBed = false;
cout<< " A guest bed will not be added to the room rate"<<endl;
break;
}
if (bedResponse == 'y' || bedResponse == 'Y' && roomType == 'L' || roomType == 'l')
{ rateLake += 20;
rateLake = roomRate;
cout<<rateLake<<endl;
}
else if (bedResponse == 'y'|| bedResponse == 'Y' && roomType == 'P' || roomType == 'p')
{ ratePool += 15;
ratePool = roomRate;
cout<<ratePool<<endl;
}
else if (bedResponse == 'y'|| bedResponse == 'Y' && roomType == 'G' || roomType == 'g')
{ rateGarden += 15;
rateGarden = roomRate;
cout<<rateGarden<<endl;
}
else
{
cout<<"\nYou have entered an invalid response. Please Re-enter. "<<endl;
cout<<" Does the guest want to use to the Gym facilities: y/n"<<endl;
cin>>gymResponse;
if ( roomType == 'Q' || roomType == 'q')
break;
if (gymResponse == 'Y' || gymResponse == 'y')
{ usesGym = true;
cout<< "\nThe guest has requested to use the Gym";
cout<< "An additonal $ 5.00 per day charge will be added to the room rate ";
}
else if (gymResponse == 'n' || gymResponse == 'N')
cout<<" The guest does not wish to use the Gym facilities ";
else
cout<<"\nYou have entered an invalid response. Please Re-enter. "<<endl;
if ( roomType == 'Q' || roomType == 'q')
break;
if (usesGym == true)
{ gymFee += 5;
}
cout<<" Has the guest completed the reservation request and ready to check-in: y/n ";
cin>>regResponse;
if ( roomType == 'Q' || roomType == 'q')
break;
if (regResponse == 'y' || regResponse == 'Y')
{ regCompleted = true;
cout<<"\nPlease wait as the registration system totals the room charges "<<endl;
}
cout<<endl;
cout<< " The charge per night for the "<<roomType<<" $ "<<roomRate<<endl;
cout<< "Total nights stay :"<<daysGueststay<<endl;
cout<< "Total charge is: "<<daysGueststay * roomRate + gymFee<<endl;
cout<<endl;
}
while(roomType != 'Q' || roomType != 'q'); // End of Loop
cout << "\n Thank You for using the Ritz Carlton Reservation System "<<endl;
cout<<endl;
return 0;
}
Compiling...
version 1.cpp
C:\IS Dept Classes\Is-343\hello\Project Ritz\version 1.cpp(175) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
version 1.exe - 1 error(s), 0 warning(s)