Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Class Project C++ reservation

Status
Not open for further replies.

Newatprogramming

Technical User
Mar 5, 2002
30
US
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<< &quot;\nWelcome to the Ritz Carlton reservation request system &quot;;
cout<< &quot;\nThe following are our room rates and amentity prices &quot;;
cout<<endl;
cout<< &quot;Garden View $125.00 per day &quot;<<endl;
cout<< &quot;Pool View $145.00 per day &quot;<<endl;
cout<< &quot;Lake View $180.00 per day &quot;<<endl;
cout<<endl;
cout<< &quot; ** The following fees are in addition to the room fee &quot;<<endl;
cout<<endl;
cout<< &quot;extra bed $15.00 per day for the Garden and Pool view rooms &quot;<<endl;
cout<< &quot;extra bed $20.00 per day for the Lake view rooms &quot;<<endl;
cout<< &quot;Gym use fee $ 5.00 per day &quot;<<endl;
cout<<endl;
cout<< &quot;A contential breakfast is complementary to all guests!!! &quot;<<endl;
cout<<endl;
cout<< &quot;All room prices are subject to change without notice &quot;<<endl;
cout<<endl;
do
{
// This menu will display the room type

int rateLake = 180, ratePool = 145, rateGarden = 125;

cout<< &quot;\nG. Garden View&quot;<<endl;
cout<< &quot;P. Pool View&quot;<<endl;
cout<< &quot;L. Lake View&quot;<<endl;
cout<< &quot;Q. Quit&quot;<<endl;

cout<< &quot;\n Please enter a room type: &quot;; // Prompt user to enter a room type
cin >>roomType; // Get input from person making the reservation
cout<<endl;

switch (roomType)
{

case 'G':
cout<<&quot; \nYou have entered a request for the Garden View room&quot;<<endl;
break;

case 'P':
cout<<&quot; \nYou have entered a request for the Pool View room &quot;<<endl;
break;

case 'L':
cout<<&quot; \nYou have entered a request for the Lake View room&quot;<<endl;
break;

case 'Q':
case 'q':
cout<<&quot; You are exiting the reservation request system &quot;<<endl;
break;
default:
cout<<&quot;\nYou have made an invalid entry &quot;<<endl;
break;
}
cout<<endl;
cout<<&quot; Does the guest need an extra bed: y/n&quot;<<endl;
cin>>bedResponse;

if (bedResponse == 'n' || bedResponse == 'N' && roomType == 'Q' || roomType == 'q')
{ extraBed = false;
cout<< &quot; A guest bed will not be added to the room rate&quot;<<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<<&quot;\nYou have entered an invalid response. Please Re-enter. &quot;<<endl;

cout<<&quot; Does the guest want to use to the Gym facilities: y/n&quot;<<endl;
cin>>gymResponse;

if ( roomType == 'Q' || roomType == 'q')
break;
if (gymResponse == 'Y' || gymResponse == 'y')
{ usesGym = true;
cout<< &quot;\nThe guest has requested to use the Gym&quot;;
cout<< &quot;An additonal $ 5.00 per day charge will be added to the room rate &quot;;
}
else if (gymResponse == 'n' || gymResponse == 'N')
cout<<&quot; The guest does not wish to use the Gym facilities &quot;;
else
cout<<&quot;\nYou have entered an invalid response. Please Re-enter. &quot;<<endl;

if ( roomType == 'Q' || roomType == 'q')
break;
if (usesGym == true)
{ gymFee += 5;
}



cout<<&quot; Has the guest completed the reservation request and ready to check-in: y/n &quot;;
cin>>regResponse;

if ( roomType == 'Q' || roomType == 'q')
break;
if (regResponse == 'y' || regResponse == 'Y')
{ regCompleted = true;
cout<<&quot;\nPlease wait as the registration system totals the room charges &quot;<<endl;
}
cout<<endl;
cout<< &quot; The charge per night for the &quot;<<roomType<<&quot; $ &quot;<<roomRate<<endl;
cout<< &quot;Total nights stay :&quot;<<daysGueststay<<endl;
cout<< &quot;Total charge is: &quot;<<daysGueststay * roomRate + gymFee<<endl;
cout<<endl;






}
while(roomType != 'Q' || roomType != 'q'); // End of Loop


cout << &quot;\n Thank You for using the Ritz Carlton Reservation System &quot;<<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)
 
here's a hint

put all your code in remark...

int main(){
/*
[your codes]
*/
}

compile... if there's no error...
just change your remark symbols
int main(){
/*
[some of your codes]
*/
[some of your codes]
}

Continue until the error occurs...

This way, you'll be able to find your bug...
hope this will help.
 
doing this I was able to locate the error...
------------------------------------------
line 102...
else{
cout<<&quot;\nYou have ... Re-enter. &quot;<<endl;
------------------------------------------
you don't close the quote '}'
------------------------------------------
else{
cout<<&quot;\nYou have ... Re-enter. &quot;<<endl;
}
------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top