Error 'class HotelRoom' has no member named 'menu' even though it is there











up vote
1
down vote

favorite












I am attempting to build a hotel reservation program in C++. however, I have an issue. I keep getting the above error message and I can't seem to find a fix.



Please provide some assistance. Anything would be greatly appreciated. Below is what I have written thus far.



using namespace std;
class HotelRoom{
private:
int roomnum; //Room numbers
int roomcap; //Room capacity
int roomoccuoystst = 0;
int maxperperroom;
double dailyrate;
public:
HotelRoom()
{
roomcap = 0;
maxperperroom = 2;
dailyrate = 175;
}

int gettotal = 0;
int gettotallist = 0;
string room;
string guestroom,message;




void viewrooms()
{
char viewselect, back;
cout<<"Which room list would you like to view ?. 1 - Add rooms, 2 - Reserved rooms : " ;
cin>>viewselect;
switch(viewselect)
{
case '1':
viewaddromm();
break;
case '2':
viewresromm();
break;
default:
cout<<"Please select from the option provided or go back to the main menu. 1 - view rooms, 2 - to the mail menu or any other key to exit the program : ";
cin>>back;
switch(back)
{
case '1':
viewrooms();
break;
case '2':
hotelmenu();
break;
default:
exitpro();

}
}
}

void viewresromm()
{
int occup,rmchoose,up;
string roomtochange, items;
string guestroomdb;
int newaccupancy;
char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
ifstream getdatafromaddroom; //creation of the ifstream object
getdatafromaddroom.open("reserveroom.out");


if(getdatafromaddroom.fail()) //if statement used for error checking
{
cout<<"Could not open file"<<endl; //message that will be printed if the program cannot open the file
}

cout<<endl;
cout<<"First Name"<<'-'<<"Last Name"<<'-'<<"Nationality"<<'-'<<"Guest(s)"<<'-'<<"Room #"<<endl;
cout<<"-------------------------------------------------------"<<endl;
string items;
while(!getdatafromaddroom.eof())
{

// getdatafromaddroom >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
//cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<' '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<' '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if( getdatafromaddroom.eof() ) break;
cout<<items<<endl;
}

for(int getlist = 0; getlist < gettotallist; getlist++ )
{
cout<<items<<endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<' '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<' '<<setw(9)<<guestroomdb<<endl;
}
}

void viewaddromm()
{
int occup,rmchoose,up;
string roomtochange;
string guestroomdb;
int newaccupancy;
char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
fstream getdatafromaddroom; //creation of the ifstream object
getdatafromaddroom.open("addroom.out");


if(getdatafromaddroom.fail()) //if statement used for error checking
{
cout<<"Could not open file"<<endl; //message that will be printed if the program cannot open the file
}

cout<<endl;
cout<<"First Name"<<'-'<<"Last Name"<<'-'<<"Nationality"<<'-'<<"Guest(s)"<<'-'<<"Room #"<<endl;
cout<<"-------------------------------------------------------"<<endl;
string items;
while(!getdatafromaddroom.eof())
{

// getdatafromaddroom >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
//cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<' '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<' '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if( getdatafromaddroom.eof() ) break;
cout<<items<<endl;
}

for(int getlist = 0; getlist < gettotallist; getlist++ )
{
cout<<items<<endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<' '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<' '<<setw(9)<<guestroomdb<<endl;
}



}

void exitpro()
{
cout<<"Program closing......Goodbye"<<endl;
system("Pause");
exit(0);
}

menu()
{
char menuchoice;
cout<<"[-------------------------------------------------------]"<<endl;
cout<<"[-Welcome to the hotel booking and reseration menu-]"<<endl;
cout<<"[--------------------------------------------------------]"<<endl;

cout<<setw(30)<<"Addroom -- 1"<<endl;
cout<<setw(32)<<"Reserve a room -- 2"<<endl;
cout<<setw(34)<<" Modify a room -- 3"<<endl;
cout<<setw(36)<<"View roms -- 4"<<endl;
cout<<setw(38)<<" Exist -- 5"<<endl;
cin>>menuchoice;
switch(menuchoice)
{
case '1':
Addroom();
break;
case '2':
reserveroom();
break;
case '3':
modifyroom();
break;
case '4':
viewrooms();
break;
}
}
};

#endif









share|improve this question









New contributor




Dray Mck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 2




    Aren't you forgetting something for the menu function? What does it return?
    – Some programmer dude
    Nov 19 at 14:07






  • 8




    Please read about Minimal, Complete, and Verifiable example. You dont need all the other methods to get an error about the missing menu member
    – user463035818
    Nov 19 at 14:08






  • 8




    Also, please learn how to create a Minimal, Complete, and Verifiable example. Then please read about how to ask good questions, as well as this question checklist. When asking about build errors, always include the actual errors you get. Copy-pasted as text, in full and complete.
    – Some programmer dude
    Nov 19 at 14:09








  • 2




    Your HotelRoom is more a Hotel instead a Room. Calling exit() is a no-no in a C++-program.
    – Swordfish
    Nov 19 at 14:11










  • I get a lot of other errors. Addroom isn't defined, and neither is hotelmenu, modifyroom or reserveroom.
    – Blaze
    Nov 19 at 14:11















up vote
1
down vote

favorite












I am attempting to build a hotel reservation program in C++. however, I have an issue. I keep getting the above error message and I can't seem to find a fix.



Please provide some assistance. Anything would be greatly appreciated. Below is what I have written thus far.



using namespace std;
class HotelRoom{
private:
int roomnum; //Room numbers
int roomcap; //Room capacity
int roomoccuoystst = 0;
int maxperperroom;
double dailyrate;
public:
HotelRoom()
{
roomcap = 0;
maxperperroom = 2;
dailyrate = 175;
}

int gettotal = 0;
int gettotallist = 0;
string room;
string guestroom,message;




void viewrooms()
{
char viewselect, back;
cout<<"Which room list would you like to view ?. 1 - Add rooms, 2 - Reserved rooms : " ;
cin>>viewselect;
switch(viewselect)
{
case '1':
viewaddromm();
break;
case '2':
viewresromm();
break;
default:
cout<<"Please select from the option provided or go back to the main menu. 1 - view rooms, 2 - to the mail menu or any other key to exit the program : ";
cin>>back;
switch(back)
{
case '1':
viewrooms();
break;
case '2':
hotelmenu();
break;
default:
exitpro();

}
}
}

void viewresromm()
{
int occup,rmchoose,up;
string roomtochange, items;
string guestroomdb;
int newaccupancy;
char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
ifstream getdatafromaddroom; //creation of the ifstream object
getdatafromaddroom.open("reserveroom.out");


if(getdatafromaddroom.fail()) //if statement used for error checking
{
cout<<"Could not open file"<<endl; //message that will be printed if the program cannot open the file
}

cout<<endl;
cout<<"First Name"<<'-'<<"Last Name"<<'-'<<"Nationality"<<'-'<<"Guest(s)"<<'-'<<"Room #"<<endl;
cout<<"-------------------------------------------------------"<<endl;
string items;
while(!getdatafromaddroom.eof())
{

// getdatafromaddroom >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
//cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<' '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<' '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if( getdatafromaddroom.eof() ) break;
cout<<items<<endl;
}

for(int getlist = 0; getlist < gettotallist; getlist++ )
{
cout<<items<<endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<' '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<' '<<setw(9)<<guestroomdb<<endl;
}
}

void viewaddromm()
{
int occup,rmchoose,up;
string roomtochange;
string guestroomdb;
int newaccupancy;
char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
fstream getdatafromaddroom; //creation of the ifstream object
getdatafromaddroom.open("addroom.out");


if(getdatafromaddroom.fail()) //if statement used for error checking
{
cout<<"Could not open file"<<endl; //message that will be printed if the program cannot open the file
}

cout<<endl;
cout<<"First Name"<<'-'<<"Last Name"<<'-'<<"Nationality"<<'-'<<"Guest(s)"<<'-'<<"Room #"<<endl;
cout<<"-------------------------------------------------------"<<endl;
string items;
while(!getdatafromaddroom.eof())
{

// getdatafromaddroom >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
//cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<' '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<' '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if( getdatafromaddroom.eof() ) break;
cout<<items<<endl;
}

for(int getlist = 0; getlist < gettotallist; getlist++ )
{
cout<<items<<endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<' '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<' '<<setw(9)<<guestroomdb<<endl;
}



}

void exitpro()
{
cout<<"Program closing......Goodbye"<<endl;
system("Pause");
exit(0);
}

menu()
{
char menuchoice;
cout<<"[-------------------------------------------------------]"<<endl;
cout<<"[-Welcome to the hotel booking and reseration menu-]"<<endl;
cout<<"[--------------------------------------------------------]"<<endl;

cout<<setw(30)<<"Addroom -- 1"<<endl;
cout<<setw(32)<<"Reserve a room -- 2"<<endl;
cout<<setw(34)<<" Modify a room -- 3"<<endl;
cout<<setw(36)<<"View roms -- 4"<<endl;
cout<<setw(38)<<" Exist -- 5"<<endl;
cin>>menuchoice;
switch(menuchoice)
{
case '1':
Addroom();
break;
case '2':
reserveroom();
break;
case '3':
modifyroom();
break;
case '4':
viewrooms();
break;
}
}
};

#endif









share|improve this question









New contributor




Dray Mck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 2




    Aren't you forgetting something for the menu function? What does it return?
    – Some programmer dude
    Nov 19 at 14:07






  • 8




    Please read about Minimal, Complete, and Verifiable example. You dont need all the other methods to get an error about the missing menu member
    – user463035818
    Nov 19 at 14:08






  • 8




    Also, please learn how to create a Minimal, Complete, and Verifiable example. Then please read about how to ask good questions, as well as this question checklist. When asking about build errors, always include the actual errors you get. Copy-pasted as text, in full and complete.
    – Some programmer dude
    Nov 19 at 14:09








  • 2




    Your HotelRoom is more a Hotel instead a Room. Calling exit() is a no-no in a C++-program.
    – Swordfish
    Nov 19 at 14:11










  • I get a lot of other errors. Addroom isn't defined, and neither is hotelmenu, modifyroom or reserveroom.
    – Blaze
    Nov 19 at 14:11













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am attempting to build a hotel reservation program in C++. however, I have an issue. I keep getting the above error message and I can't seem to find a fix.



Please provide some assistance. Anything would be greatly appreciated. Below is what I have written thus far.



using namespace std;
class HotelRoom{
private:
int roomnum; //Room numbers
int roomcap; //Room capacity
int roomoccuoystst = 0;
int maxperperroom;
double dailyrate;
public:
HotelRoom()
{
roomcap = 0;
maxperperroom = 2;
dailyrate = 175;
}

int gettotal = 0;
int gettotallist = 0;
string room;
string guestroom,message;




void viewrooms()
{
char viewselect, back;
cout<<"Which room list would you like to view ?. 1 - Add rooms, 2 - Reserved rooms : " ;
cin>>viewselect;
switch(viewselect)
{
case '1':
viewaddromm();
break;
case '2':
viewresromm();
break;
default:
cout<<"Please select from the option provided or go back to the main menu. 1 - view rooms, 2 - to the mail menu or any other key to exit the program : ";
cin>>back;
switch(back)
{
case '1':
viewrooms();
break;
case '2':
hotelmenu();
break;
default:
exitpro();

}
}
}

void viewresromm()
{
int occup,rmchoose,up;
string roomtochange, items;
string guestroomdb;
int newaccupancy;
char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
ifstream getdatafromaddroom; //creation of the ifstream object
getdatafromaddroom.open("reserveroom.out");


if(getdatafromaddroom.fail()) //if statement used for error checking
{
cout<<"Could not open file"<<endl; //message that will be printed if the program cannot open the file
}

cout<<endl;
cout<<"First Name"<<'-'<<"Last Name"<<'-'<<"Nationality"<<'-'<<"Guest(s)"<<'-'<<"Room #"<<endl;
cout<<"-------------------------------------------------------"<<endl;
string items;
while(!getdatafromaddroom.eof())
{

// getdatafromaddroom >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
//cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<' '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<' '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if( getdatafromaddroom.eof() ) break;
cout<<items<<endl;
}

for(int getlist = 0; getlist < gettotallist; getlist++ )
{
cout<<items<<endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<' '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<' '<<setw(9)<<guestroomdb<<endl;
}
}

void viewaddromm()
{
int occup,rmchoose,up;
string roomtochange;
string guestroomdb;
int newaccupancy;
char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
fstream getdatafromaddroom; //creation of the ifstream object
getdatafromaddroom.open("addroom.out");


if(getdatafromaddroom.fail()) //if statement used for error checking
{
cout<<"Could not open file"<<endl; //message that will be printed if the program cannot open the file
}

cout<<endl;
cout<<"First Name"<<'-'<<"Last Name"<<'-'<<"Nationality"<<'-'<<"Guest(s)"<<'-'<<"Room #"<<endl;
cout<<"-------------------------------------------------------"<<endl;
string items;
while(!getdatafromaddroom.eof())
{

// getdatafromaddroom >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
//cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<' '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<' '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if( getdatafromaddroom.eof() ) break;
cout<<items<<endl;
}

for(int getlist = 0; getlist < gettotallist; getlist++ )
{
cout<<items<<endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<' '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<' '<<setw(9)<<guestroomdb<<endl;
}



}

void exitpro()
{
cout<<"Program closing......Goodbye"<<endl;
system("Pause");
exit(0);
}

menu()
{
char menuchoice;
cout<<"[-------------------------------------------------------]"<<endl;
cout<<"[-Welcome to the hotel booking and reseration menu-]"<<endl;
cout<<"[--------------------------------------------------------]"<<endl;

cout<<setw(30)<<"Addroom -- 1"<<endl;
cout<<setw(32)<<"Reserve a room -- 2"<<endl;
cout<<setw(34)<<" Modify a room -- 3"<<endl;
cout<<setw(36)<<"View roms -- 4"<<endl;
cout<<setw(38)<<" Exist -- 5"<<endl;
cin>>menuchoice;
switch(menuchoice)
{
case '1':
Addroom();
break;
case '2':
reserveroom();
break;
case '3':
modifyroom();
break;
case '4':
viewrooms();
break;
}
}
};

#endif









share|improve this question









New contributor




Dray Mck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I am attempting to build a hotel reservation program in C++. however, I have an issue. I keep getting the above error message and I can't seem to find a fix.



Please provide some assistance. Anything would be greatly appreciated. Below is what I have written thus far.



using namespace std;
class HotelRoom{
private:
int roomnum; //Room numbers
int roomcap; //Room capacity
int roomoccuoystst = 0;
int maxperperroom;
double dailyrate;
public:
HotelRoom()
{
roomcap = 0;
maxperperroom = 2;
dailyrate = 175;
}

int gettotal = 0;
int gettotallist = 0;
string room;
string guestroom,message;




void viewrooms()
{
char viewselect, back;
cout<<"Which room list would you like to view ?. 1 - Add rooms, 2 - Reserved rooms : " ;
cin>>viewselect;
switch(viewselect)
{
case '1':
viewaddromm();
break;
case '2':
viewresromm();
break;
default:
cout<<"Please select from the option provided or go back to the main menu. 1 - view rooms, 2 - to the mail menu or any other key to exit the program : ";
cin>>back;
switch(back)
{
case '1':
viewrooms();
break;
case '2':
hotelmenu();
break;
default:
exitpro();

}
}
}

void viewresromm()
{
int occup,rmchoose,up;
string roomtochange, items;
string guestroomdb;
int newaccupancy;
char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
ifstream getdatafromaddroom; //creation of the ifstream object
getdatafromaddroom.open("reserveroom.out");


if(getdatafromaddroom.fail()) //if statement used for error checking
{
cout<<"Could not open file"<<endl; //message that will be printed if the program cannot open the file
}

cout<<endl;
cout<<"First Name"<<'-'<<"Last Name"<<'-'<<"Nationality"<<'-'<<"Guest(s)"<<'-'<<"Room #"<<endl;
cout<<"-------------------------------------------------------"<<endl;
string items;
while(!getdatafromaddroom.eof())
{

// getdatafromaddroom >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
//cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<' '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<' '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if( getdatafromaddroom.eof() ) break;
cout<<items<<endl;
}

for(int getlist = 0; getlist < gettotallist; getlist++ )
{
cout<<items<<endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<' '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<' '<<setw(9)<<guestroomdb<<endl;
}
}

void viewaddromm()
{
int occup,rmchoose,up;
string roomtochange;
string guestroomdb;
int newaccupancy;
char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
fstream getdatafromaddroom; //creation of the ifstream object
getdatafromaddroom.open("addroom.out");


if(getdatafromaddroom.fail()) //if statement used for error checking
{
cout<<"Could not open file"<<endl; //message that will be printed if the program cannot open the file
}

cout<<endl;
cout<<"First Name"<<'-'<<"Last Name"<<'-'<<"Nationality"<<'-'<<"Guest(s)"<<'-'<<"Room #"<<endl;
cout<<"-------------------------------------------------------"<<endl;
string items;
while(!getdatafromaddroom.eof())
{

// getdatafromaddroom >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
//cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<' '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<' '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if( getdatafromaddroom.eof() ) break;
cout<<items<<endl;
}

for(int getlist = 0; getlist < gettotallist; getlist++ )
{
cout<<items<<endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<' '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<' '<<setw(9)<<guestroomdb<<endl;
}



}

void exitpro()
{
cout<<"Program closing......Goodbye"<<endl;
system("Pause");
exit(0);
}

menu()
{
char menuchoice;
cout<<"[-------------------------------------------------------]"<<endl;
cout<<"[-Welcome to the hotel booking and reseration menu-]"<<endl;
cout<<"[--------------------------------------------------------]"<<endl;

cout<<setw(30)<<"Addroom -- 1"<<endl;
cout<<setw(32)<<"Reserve a room -- 2"<<endl;
cout<<setw(34)<<" Modify a room -- 3"<<endl;
cout<<setw(36)<<"View roms -- 4"<<endl;
cout<<setw(38)<<" Exist -- 5"<<endl;
cin>>menuchoice;
switch(menuchoice)
{
case '1':
Addroom();
break;
case '2':
reserveroom();
break;
case '3':
modifyroom();
break;
case '4':
viewrooms();
break;
}
}
};

#endif






c++






share|improve this question









New contributor




Dray Mck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Dray Mck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Nov 19 at 18:14









user6910411

31.9k76692




31.9k76692






New contributor




Dray Mck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 19 at 14:05









Dray Mck

12




12




New contributor




Dray Mck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Dray Mck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Dray Mck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 2




    Aren't you forgetting something for the menu function? What does it return?
    – Some programmer dude
    Nov 19 at 14:07






  • 8




    Please read about Minimal, Complete, and Verifiable example. You dont need all the other methods to get an error about the missing menu member
    – user463035818
    Nov 19 at 14:08






  • 8




    Also, please learn how to create a Minimal, Complete, and Verifiable example. Then please read about how to ask good questions, as well as this question checklist. When asking about build errors, always include the actual errors you get. Copy-pasted as text, in full and complete.
    – Some programmer dude
    Nov 19 at 14:09








  • 2




    Your HotelRoom is more a Hotel instead a Room. Calling exit() is a no-no in a C++-program.
    – Swordfish
    Nov 19 at 14:11










  • I get a lot of other errors. Addroom isn't defined, and neither is hotelmenu, modifyroom or reserveroom.
    – Blaze
    Nov 19 at 14:11














  • 2




    Aren't you forgetting something for the menu function? What does it return?
    – Some programmer dude
    Nov 19 at 14:07






  • 8




    Please read about Minimal, Complete, and Verifiable example. You dont need all the other methods to get an error about the missing menu member
    – user463035818
    Nov 19 at 14:08






  • 8




    Also, please learn how to create a Minimal, Complete, and Verifiable example. Then please read about how to ask good questions, as well as this question checklist. When asking about build errors, always include the actual errors you get. Copy-pasted as text, in full and complete.
    – Some programmer dude
    Nov 19 at 14:09








  • 2




    Your HotelRoom is more a Hotel instead a Room. Calling exit() is a no-no in a C++-program.
    – Swordfish
    Nov 19 at 14:11










  • I get a lot of other errors. Addroom isn't defined, and neither is hotelmenu, modifyroom or reserveroom.
    – Blaze
    Nov 19 at 14:11








2




2




Aren't you forgetting something for the menu function? What does it return?
– Some programmer dude
Nov 19 at 14:07




Aren't you forgetting something for the menu function? What does it return?
– Some programmer dude
Nov 19 at 14:07




8




8




Please read about Minimal, Complete, and Verifiable example. You dont need all the other methods to get an error about the missing menu member
– user463035818
Nov 19 at 14:08




Please read about Minimal, Complete, and Verifiable example. You dont need all the other methods to get an error about the missing menu member
– user463035818
Nov 19 at 14:08




8




8




Also, please learn how to create a Minimal, Complete, and Verifiable example. Then please read about how to ask good questions, as well as this question checklist. When asking about build errors, always include the actual errors you get. Copy-pasted as text, in full and complete.
– Some programmer dude
Nov 19 at 14:09






Also, please learn how to create a Minimal, Complete, and Verifiable example. Then please read about how to ask good questions, as well as this question checklist. When asking about build errors, always include the actual errors you get. Copy-pasted as text, in full and complete.
– Some programmer dude
Nov 19 at 14:09






2




2




Your HotelRoom is more a Hotel instead a Room. Calling exit() is a no-no in a C++-program.
– Swordfish
Nov 19 at 14:11




Your HotelRoom is more a Hotel instead a Room. Calling exit() is a no-no in a C++-program.
– Swordfish
Nov 19 at 14:11












I get a lot of other errors. Addroom isn't defined, and neither is hotelmenu, modifyroom or reserveroom.
– Blaze
Nov 19 at 14:11




I get a lot of other errors. Addroom isn't defined, and neither is hotelmenu, modifyroom or reserveroom.
– Blaze
Nov 19 at 14:11












1 Answer
1






active

oldest

votes

















up vote
0
down vote













#include<string>
#include<iostream>
#include<fstream>
#include<iomanip>

using namespace std;
class HotelRoom
{
private:
int roomnum; // Room numbers
int roomcap; // Room capacity
int roomoccuoystst = 0;
int maxperperroom;
double dailyrate;
public:


HotelRoom()
{
roomcap = 0;
maxperperroom = 2;
dailyrate = 175;
}

int gettotal = 0;
int gettotallist = 0;
string room;
string guestroom, message;




void viewrooms()
{
char viewselect, back;
cout << "Which room list would you like to view ?. 1 - Add rooms, 2 - Reserved rooms : ";
cin >> viewselect;
switch (viewselect)
{
case '1':
viewaddromm();
break;
case '2':
viewresromm();
break;
default:
cout <<
"Please select from the option provided or go back to the main menu. 1 - view rooms, 2 - to the mail menu or any other key to exit the program : ";
cin >> back;
switch (back)
{
case '1':
viewrooms();
break;
case '2':
menu();
break;
default:
exitpro();

}
}
}

void viewresromm()
{

string roomtochange, items;
string guestroomdb;
// int newaccupancy;
// char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
ifstream getdatafromaddroom; // creation of the ifstream object
getdatafromaddroom.open("reserveroom.out");


if (getdatafromaddroom.fail()) // if statement used for error
// checking
{
cout << "Could not open file" << endl; // message that will be
// printed if the program
// cannot open the file
return;
}

cout << endl;
cout << "First Name" << '-' << "Last Name" << '-' << "Nationality" << '-' << "Guest(s)" <<
'-' << "Room #" << endl;
cout << "-------------------------------------------------------" << endl;
// string items;
while (!getdatafromaddroom.eof())
{

// getdatafromaddroom
// >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if (getdatafromaddroom.eof())
break;
cout << items << endl;
}

for (int getlist = 0; getlist < gettotallist; getlist++)
{
cout << items << endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
}
}

void viewaddromm()
{
// int occup,rmchoose,up;
string roomtochange;
string guestroomdb;
// int newaccupancy;
// char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
fstream getdatafromaddroom; // creation of the ifstream object
getdatafromaddroom.open("addroom.out");


if (getdatafromaddroom.fail()) // if statement used for error
// checking
{
cout << "Could not open file" << endl; // message that will be
// printed if the program
// cannot open the file
return;
}

cout << endl;
cout << "First Name" << '-' << "Last Name" << '-' << "Nationality" << '-' << "Guest(s)" <<
'-' << "Room #" << endl;
cout << "-------------------------------------------------------" << endl;
string items;
while (!getdatafromaddroom.eof())
{

// getdatafromaddroom
// >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if (getdatafromaddroom.eof())
break;
cout << items << endl;
}

for (int getlist = 0; getlist < gettotallist; getlist++)
{
cout << items << endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
}



}

void exitpro()
{
cout << "Program closing......Goodbye" << endl;
// system("Pause");
exit(0);
}

void Addroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void reserveroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void modifyroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void menu()
{
while (true)
{
char menuchoice;
cout << "[-------------------------------------------------------]" << endl;
cout << "[-Welcome to the hotel booking and reseration menu-]" << endl;
cout << "[--------------------------------------------------------]" << endl;

cout << setw(30) << "Addroom -- 1" << endl;
cout << setw(30) << "Reserve a room -- 2" << endl;
cout << setw(30) << "Modify a room -- 3" << endl;
cout << setw(30) << "View rooms -- 4" << endl;
cout << setw(30) << "Exit -- 5" << endl;
cin >> menuchoice;
switch (menuchoice)
{
case '1':
Addroom();
break;
case '2':
reserveroom();
break;
case '3':
modifyroom();
break;
case '4':
viewrooms();
break;
case '5':
exitpro();
}
}
}
};

int main()
{
try
{
HotelRoom room;
room.menu();
}
catch(std::logic_error * ex)
{
std::cout << ex->what();
}

}


you have a lot more to go with this project. I've fixed the portion you specifically asked about and its now a runninng application with somewhat approperate diagnostics. I'm not going to get too deep into how this language works but you have several functions that were not implimented, missing return types, and just general logic errors like trying to use a file after you determined it wasnt open. it runs now, and you can get a clear indication of what you need to complete. You also had several unused varables.



i added , at minimal,



void Addroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void reserveroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void modifyroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());


}


and a return type to menu.
`void menu()



you cannot call functions you have not yet written, and all functions have a return type even if they return nothing.



Good luck!






share|improve this answer























  • Hi, can you highlight the major changes you made, each along with a brief explanation or in-code comment? It's difficult to go through all the code looking for "what mistake I made" or "where I could improve on". Thanks!
    – TrebuchetMS
    Nov 19 at 15:01










  • To add, I only get this error when I am using dev c++, and the 3 functions you are referring to were implemented. Addroom() void reserveroom() void modifyroom()
    – Dray Mck
    Nov 19 at 15:35












  • Dray Mck they were not in the sample in your question. Read the comments on your post I'm not the only person that noticed that
    – johnathan
    Nov 19 at 15:37












  • Thats what I am saying. The program is a lot. . i should have removed the ones i didnt include in the question .if you want me to send the entire file i could
    – Dray Mck
    Nov 19 at 15:43










  • Dray Mck sure just give me an ideone.com link
    – johnathan
    Nov 19 at 15:46











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Dray Mck is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376361%2ferror-class-hotelroom-has-no-member-named-menu-even-though-it-is-there%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













#include<string>
#include<iostream>
#include<fstream>
#include<iomanip>

using namespace std;
class HotelRoom
{
private:
int roomnum; // Room numbers
int roomcap; // Room capacity
int roomoccuoystst = 0;
int maxperperroom;
double dailyrate;
public:


HotelRoom()
{
roomcap = 0;
maxperperroom = 2;
dailyrate = 175;
}

int gettotal = 0;
int gettotallist = 0;
string room;
string guestroom, message;




void viewrooms()
{
char viewselect, back;
cout << "Which room list would you like to view ?. 1 - Add rooms, 2 - Reserved rooms : ";
cin >> viewselect;
switch (viewselect)
{
case '1':
viewaddromm();
break;
case '2':
viewresromm();
break;
default:
cout <<
"Please select from the option provided or go back to the main menu. 1 - view rooms, 2 - to the mail menu or any other key to exit the program : ";
cin >> back;
switch (back)
{
case '1':
viewrooms();
break;
case '2':
menu();
break;
default:
exitpro();

}
}
}

void viewresromm()
{

string roomtochange, items;
string guestroomdb;
// int newaccupancy;
// char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
ifstream getdatafromaddroom; // creation of the ifstream object
getdatafromaddroom.open("reserveroom.out");


if (getdatafromaddroom.fail()) // if statement used for error
// checking
{
cout << "Could not open file" << endl; // message that will be
// printed if the program
// cannot open the file
return;
}

cout << endl;
cout << "First Name" << '-' << "Last Name" << '-' << "Nationality" << '-' << "Guest(s)" <<
'-' << "Room #" << endl;
cout << "-------------------------------------------------------" << endl;
// string items;
while (!getdatafromaddroom.eof())
{

// getdatafromaddroom
// >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if (getdatafromaddroom.eof())
break;
cout << items << endl;
}

for (int getlist = 0; getlist < gettotallist; getlist++)
{
cout << items << endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
}
}

void viewaddromm()
{
// int occup,rmchoose,up;
string roomtochange;
string guestroomdb;
// int newaccupancy;
// char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
fstream getdatafromaddroom; // creation of the ifstream object
getdatafromaddroom.open("addroom.out");


if (getdatafromaddroom.fail()) // if statement used for error
// checking
{
cout << "Could not open file" << endl; // message that will be
// printed if the program
// cannot open the file
return;
}

cout << endl;
cout << "First Name" << '-' << "Last Name" << '-' << "Nationality" << '-' << "Guest(s)" <<
'-' << "Room #" << endl;
cout << "-------------------------------------------------------" << endl;
string items;
while (!getdatafromaddroom.eof())
{

// getdatafromaddroom
// >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if (getdatafromaddroom.eof())
break;
cout << items << endl;
}

for (int getlist = 0; getlist < gettotallist; getlist++)
{
cout << items << endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
}



}

void exitpro()
{
cout << "Program closing......Goodbye" << endl;
// system("Pause");
exit(0);
}

void Addroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void reserveroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void modifyroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void menu()
{
while (true)
{
char menuchoice;
cout << "[-------------------------------------------------------]" << endl;
cout << "[-Welcome to the hotel booking and reseration menu-]" << endl;
cout << "[--------------------------------------------------------]" << endl;

cout << setw(30) << "Addroom -- 1" << endl;
cout << setw(30) << "Reserve a room -- 2" << endl;
cout << setw(30) << "Modify a room -- 3" << endl;
cout << setw(30) << "View rooms -- 4" << endl;
cout << setw(30) << "Exit -- 5" << endl;
cin >> menuchoice;
switch (menuchoice)
{
case '1':
Addroom();
break;
case '2':
reserveroom();
break;
case '3':
modifyroom();
break;
case '4':
viewrooms();
break;
case '5':
exitpro();
}
}
}
};

int main()
{
try
{
HotelRoom room;
room.menu();
}
catch(std::logic_error * ex)
{
std::cout << ex->what();
}

}


you have a lot more to go with this project. I've fixed the portion you specifically asked about and its now a runninng application with somewhat approperate diagnostics. I'm not going to get too deep into how this language works but you have several functions that were not implimented, missing return types, and just general logic errors like trying to use a file after you determined it wasnt open. it runs now, and you can get a clear indication of what you need to complete. You also had several unused varables.



i added , at minimal,



void Addroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void reserveroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void modifyroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());


}


and a return type to menu.
`void menu()



you cannot call functions you have not yet written, and all functions have a return type even if they return nothing.



Good luck!






share|improve this answer























  • Hi, can you highlight the major changes you made, each along with a brief explanation or in-code comment? It's difficult to go through all the code looking for "what mistake I made" or "where I could improve on". Thanks!
    – TrebuchetMS
    Nov 19 at 15:01










  • To add, I only get this error when I am using dev c++, and the 3 functions you are referring to were implemented. Addroom() void reserveroom() void modifyroom()
    – Dray Mck
    Nov 19 at 15:35












  • Dray Mck they were not in the sample in your question. Read the comments on your post I'm not the only person that noticed that
    – johnathan
    Nov 19 at 15:37












  • Thats what I am saying. The program is a lot. . i should have removed the ones i didnt include in the question .if you want me to send the entire file i could
    – Dray Mck
    Nov 19 at 15:43










  • Dray Mck sure just give me an ideone.com link
    – johnathan
    Nov 19 at 15:46















up vote
0
down vote













#include<string>
#include<iostream>
#include<fstream>
#include<iomanip>

using namespace std;
class HotelRoom
{
private:
int roomnum; // Room numbers
int roomcap; // Room capacity
int roomoccuoystst = 0;
int maxperperroom;
double dailyrate;
public:


HotelRoom()
{
roomcap = 0;
maxperperroom = 2;
dailyrate = 175;
}

int gettotal = 0;
int gettotallist = 0;
string room;
string guestroom, message;




void viewrooms()
{
char viewselect, back;
cout << "Which room list would you like to view ?. 1 - Add rooms, 2 - Reserved rooms : ";
cin >> viewselect;
switch (viewselect)
{
case '1':
viewaddromm();
break;
case '2':
viewresromm();
break;
default:
cout <<
"Please select from the option provided or go back to the main menu. 1 - view rooms, 2 - to the mail menu or any other key to exit the program : ";
cin >> back;
switch (back)
{
case '1':
viewrooms();
break;
case '2':
menu();
break;
default:
exitpro();

}
}
}

void viewresromm()
{

string roomtochange, items;
string guestroomdb;
// int newaccupancy;
// char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
ifstream getdatafromaddroom; // creation of the ifstream object
getdatafromaddroom.open("reserveroom.out");


if (getdatafromaddroom.fail()) // if statement used for error
// checking
{
cout << "Could not open file" << endl; // message that will be
// printed if the program
// cannot open the file
return;
}

cout << endl;
cout << "First Name" << '-' << "Last Name" << '-' << "Nationality" << '-' << "Guest(s)" <<
'-' << "Room #" << endl;
cout << "-------------------------------------------------------" << endl;
// string items;
while (!getdatafromaddroom.eof())
{

// getdatafromaddroom
// >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if (getdatafromaddroom.eof())
break;
cout << items << endl;
}

for (int getlist = 0; getlist < gettotallist; getlist++)
{
cout << items << endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
}
}

void viewaddromm()
{
// int occup,rmchoose,up;
string roomtochange;
string guestroomdb;
// int newaccupancy;
// char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
fstream getdatafromaddroom; // creation of the ifstream object
getdatafromaddroom.open("addroom.out");


if (getdatafromaddroom.fail()) // if statement used for error
// checking
{
cout << "Could not open file" << endl; // message that will be
// printed if the program
// cannot open the file
return;
}

cout << endl;
cout << "First Name" << '-' << "Last Name" << '-' << "Nationality" << '-' << "Guest(s)" <<
'-' << "Room #" << endl;
cout << "-------------------------------------------------------" << endl;
string items;
while (!getdatafromaddroom.eof())
{

// getdatafromaddroom
// >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if (getdatafromaddroom.eof())
break;
cout << items << endl;
}

for (int getlist = 0; getlist < gettotallist; getlist++)
{
cout << items << endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
}



}

void exitpro()
{
cout << "Program closing......Goodbye" << endl;
// system("Pause");
exit(0);
}

void Addroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void reserveroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void modifyroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void menu()
{
while (true)
{
char menuchoice;
cout << "[-------------------------------------------------------]" << endl;
cout << "[-Welcome to the hotel booking and reseration menu-]" << endl;
cout << "[--------------------------------------------------------]" << endl;

cout << setw(30) << "Addroom -- 1" << endl;
cout << setw(30) << "Reserve a room -- 2" << endl;
cout << setw(30) << "Modify a room -- 3" << endl;
cout << setw(30) << "View rooms -- 4" << endl;
cout << setw(30) << "Exit -- 5" << endl;
cin >> menuchoice;
switch (menuchoice)
{
case '1':
Addroom();
break;
case '2':
reserveroom();
break;
case '3':
modifyroom();
break;
case '4':
viewrooms();
break;
case '5':
exitpro();
}
}
}
};

int main()
{
try
{
HotelRoom room;
room.menu();
}
catch(std::logic_error * ex)
{
std::cout << ex->what();
}

}


you have a lot more to go with this project. I've fixed the portion you specifically asked about and its now a runninng application with somewhat approperate diagnostics. I'm not going to get too deep into how this language works but you have several functions that were not implimented, missing return types, and just general logic errors like trying to use a file after you determined it wasnt open. it runs now, and you can get a clear indication of what you need to complete. You also had several unused varables.



i added , at minimal,



void Addroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void reserveroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void modifyroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());


}


and a return type to menu.
`void menu()



you cannot call functions you have not yet written, and all functions have a return type even if they return nothing.



Good luck!






share|improve this answer























  • Hi, can you highlight the major changes you made, each along with a brief explanation or in-code comment? It's difficult to go through all the code looking for "what mistake I made" or "where I could improve on". Thanks!
    – TrebuchetMS
    Nov 19 at 15:01










  • To add, I only get this error when I am using dev c++, and the 3 functions you are referring to were implemented. Addroom() void reserveroom() void modifyroom()
    – Dray Mck
    Nov 19 at 15:35












  • Dray Mck they were not in the sample in your question. Read the comments on your post I'm not the only person that noticed that
    – johnathan
    Nov 19 at 15:37












  • Thats what I am saying. The program is a lot. . i should have removed the ones i didnt include in the question .if you want me to send the entire file i could
    – Dray Mck
    Nov 19 at 15:43










  • Dray Mck sure just give me an ideone.com link
    – johnathan
    Nov 19 at 15:46













up vote
0
down vote










up vote
0
down vote









#include<string>
#include<iostream>
#include<fstream>
#include<iomanip>

using namespace std;
class HotelRoom
{
private:
int roomnum; // Room numbers
int roomcap; // Room capacity
int roomoccuoystst = 0;
int maxperperroom;
double dailyrate;
public:


HotelRoom()
{
roomcap = 0;
maxperperroom = 2;
dailyrate = 175;
}

int gettotal = 0;
int gettotallist = 0;
string room;
string guestroom, message;




void viewrooms()
{
char viewselect, back;
cout << "Which room list would you like to view ?. 1 - Add rooms, 2 - Reserved rooms : ";
cin >> viewselect;
switch (viewselect)
{
case '1':
viewaddromm();
break;
case '2':
viewresromm();
break;
default:
cout <<
"Please select from the option provided or go back to the main menu. 1 - view rooms, 2 - to the mail menu or any other key to exit the program : ";
cin >> back;
switch (back)
{
case '1':
viewrooms();
break;
case '2':
menu();
break;
default:
exitpro();

}
}
}

void viewresromm()
{

string roomtochange, items;
string guestroomdb;
// int newaccupancy;
// char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
ifstream getdatafromaddroom; // creation of the ifstream object
getdatafromaddroom.open("reserveroom.out");


if (getdatafromaddroom.fail()) // if statement used for error
// checking
{
cout << "Could not open file" << endl; // message that will be
// printed if the program
// cannot open the file
return;
}

cout << endl;
cout << "First Name" << '-' << "Last Name" << '-' << "Nationality" << '-' << "Guest(s)" <<
'-' << "Room #" << endl;
cout << "-------------------------------------------------------" << endl;
// string items;
while (!getdatafromaddroom.eof())
{

// getdatafromaddroom
// >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if (getdatafromaddroom.eof())
break;
cout << items << endl;
}

for (int getlist = 0; getlist < gettotallist; getlist++)
{
cout << items << endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
}
}

void viewaddromm()
{
// int occup,rmchoose,up;
string roomtochange;
string guestroomdb;
// int newaccupancy;
// char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
fstream getdatafromaddroom; // creation of the ifstream object
getdatafromaddroom.open("addroom.out");


if (getdatafromaddroom.fail()) // if statement used for error
// checking
{
cout << "Could not open file" << endl; // message that will be
// printed if the program
// cannot open the file
return;
}

cout << endl;
cout << "First Name" << '-' << "Last Name" << '-' << "Nationality" << '-' << "Guest(s)" <<
'-' << "Room #" << endl;
cout << "-------------------------------------------------------" << endl;
string items;
while (!getdatafromaddroom.eof())
{

// getdatafromaddroom
// >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if (getdatafromaddroom.eof())
break;
cout << items << endl;
}

for (int getlist = 0; getlist < gettotallist; getlist++)
{
cout << items << endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
}



}

void exitpro()
{
cout << "Program closing......Goodbye" << endl;
// system("Pause");
exit(0);
}

void Addroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void reserveroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void modifyroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void menu()
{
while (true)
{
char menuchoice;
cout << "[-------------------------------------------------------]" << endl;
cout << "[-Welcome to the hotel booking and reseration menu-]" << endl;
cout << "[--------------------------------------------------------]" << endl;

cout << setw(30) << "Addroom -- 1" << endl;
cout << setw(30) << "Reserve a room -- 2" << endl;
cout << setw(30) << "Modify a room -- 3" << endl;
cout << setw(30) << "View rooms -- 4" << endl;
cout << setw(30) << "Exit -- 5" << endl;
cin >> menuchoice;
switch (menuchoice)
{
case '1':
Addroom();
break;
case '2':
reserveroom();
break;
case '3':
modifyroom();
break;
case '4':
viewrooms();
break;
case '5':
exitpro();
}
}
}
};

int main()
{
try
{
HotelRoom room;
room.menu();
}
catch(std::logic_error * ex)
{
std::cout << ex->what();
}

}


you have a lot more to go with this project. I've fixed the portion you specifically asked about and its now a runninng application with somewhat approperate diagnostics. I'm not going to get too deep into how this language works but you have several functions that were not implimented, missing return types, and just general logic errors like trying to use a file after you determined it wasnt open. it runs now, and you can get a clear indication of what you need to complete. You also had several unused varables.



i added , at minimal,



void Addroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void reserveroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void modifyroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());


}


and a return type to menu.
`void menu()



you cannot call functions you have not yet written, and all functions have a return type even if they return nothing.



Good luck!






share|improve this answer














#include<string>
#include<iostream>
#include<fstream>
#include<iomanip>

using namespace std;
class HotelRoom
{
private:
int roomnum; // Room numbers
int roomcap; // Room capacity
int roomoccuoystst = 0;
int maxperperroom;
double dailyrate;
public:


HotelRoom()
{
roomcap = 0;
maxperperroom = 2;
dailyrate = 175;
}

int gettotal = 0;
int gettotallist = 0;
string room;
string guestroom, message;




void viewrooms()
{
char viewselect, back;
cout << "Which room list would you like to view ?. 1 - Add rooms, 2 - Reserved rooms : ";
cin >> viewselect;
switch (viewselect)
{
case '1':
viewaddromm();
break;
case '2':
viewresromm();
break;
default:
cout <<
"Please select from the option provided or go back to the main menu. 1 - view rooms, 2 - to the mail menu or any other key to exit the program : ";
cin >> back;
switch (back)
{
case '1':
viewrooms();
break;
case '2':
menu();
break;
default:
exitpro();

}
}
}

void viewresromm()
{

string roomtochange, items;
string guestroomdb;
// int newaccupancy;
// char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
ifstream getdatafromaddroom; // creation of the ifstream object
getdatafromaddroom.open("reserveroom.out");


if (getdatafromaddroom.fail()) // if statement used for error
// checking
{
cout << "Could not open file" << endl; // message that will be
// printed if the program
// cannot open the file
return;
}

cout << endl;
cout << "First Name" << '-' << "Last Name" << '-' << "Nationality" << '-' << "Guest(s)" <<
'-' << "Room #" << endl;
cout << "-------------------------------------------------------" << endl;
// string items;
while (!getdatafromaddroom.eof())
{

// getdatafromaddroom
// >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if (getdatafromaddroom.eof())
break;
cout << items << endl;
}

for (int getlist = 0; getlist < gettotallist; getlist++)
{
cout << items << endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
}
}

void viewaddromm()
{
// int occup,rmchoose,up;
string roomtochange;
string guestroomdb;
// int newaccupancy;
// char decisionmade,savinf;
string fname, lname, nationality;
string checkaddroom;
fstream getdatafromaddroom; // creation of the ifstream object
getdatafromaddroom.open("addroom.out");


if (getdatafromaddroom.fail()) // if statement used for error
// checking
{
cout << "Could not open file" << endl; // message that will be
// printed if the program
// cannot open the file
return;
}

cout << endl;
cout << "First Name" << '-' << "Last Name" << '-' << "Nationality" << '-' << "Guest(s)" <<
'-' << "Room #" << endl;
cout << "-------------------------------------------------------" << endl;
string items;
while (!getdatafromaddroom.eof())
{

// getdatafromaddroom
// >>fname>>lname>>nationality>>occup>>guestroomdb;
getline(getdatafromaddroom, items);
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
gettotallist++;

if (getdatafromaddroom.eof())
break;
cout << items << endl;
}

for (int getlist = 0; getlist < gettotallist; getlist++)
{
cout << items << endl;
// cout<<setw(5)<<fname<<' '<<setw(10)<<lname<<'
// '<<setw(10)<<nationality<<' '<<setw(10)<<occup<<'
// '<<setw(9)<<guestroomdb<<endl;
}



}

void exitpro()
{
cout << "Program closing......Goodbye" << endl;
// system("Pause");
exit(0);
}

void Addroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void reserveroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void modifyroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void menu()
{
while (true)
{
char menuchoice;
cout << "[-------------------------------------------------------]" << endl;
cout << "[-Welcome to the hotel booking and reseration menu-]" << endl;
cout << "[--------------------------------------------------------]" << endl;

cout << setw(30) << "Addroom -- 1" << endl;
cout << setw(30) << "Reserve a room -- 2" << endl;
cout << setw(30) << "Modify a room -- 3" << endl;
cout << setw(30) << "View rooms -- 4" << endl;
cout << setw(30) << "Exit -- 5" << endl;
cin >> menuchoice;
switch (menuchoice)
{
case '1':
Addroom();
break;
case '2':
reserveroom();
break;
case '3':
modifyroom();
break;
case '4':
viewrooms();
break;
case '5':
exitpro();
}
}
}
};

int main()
{
try
{
HotelRoom room;
room.menu();
}
catch(std::logic_error * ex)
{
std::cout << ex->what();
}

}


you have a lot more to go with this project. I've fixed the portion you specifically asked about and its now a runninng application with somewhat approperate diagnostics. I'm not going to get too deep into how this language works but you have several functions that were not implimented, missing return types, and just general logic errors like trying to use a file after you determined it wasnt open. it runs now, and you can get a clear indication of what you need to complete. You also had several unused varables.



i added , at minimal,



void Addroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void reserveroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());
}

void modifyroom()
{
std::string mess = __func__;
mess += " is not yet implimented.";
throw new std::logic_error(mess.c_str());


}


and a return type to menu.
`void menu()



you cannot call functions you have not yet written, and all functions have a return type even if they return nothing.



Good luck!







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 19 at 15:03

























answered Nov 19 at 14:50









johnathan

2,143819




2,143819












  • Hi, can you highlight the major changes you made, each along with a brief explanation or in-code comment? It's difficult to go through all the code looking for "what mistake I made" or "where I could improve on". Thanks!
    – TrebuchetMS
    Nov 19 at 15:01










  • To add, I only get this error when I am using dev c++, and the 3 functions you are referring to were implemented. Addroom() void reserveroom() void modifyroom()
    – Dray Mck
    Nov 19 at 15:35












  • Dray Mck they were not in the sample in your question. Read the comments on your post I'm not the only person that noticed that
    – johnathan
    Nov 19 at 15:37












  • Thats what I am saying. The program is a lot. . i should have removed the ones i didnt include in the question .if you want me to send the entire file i could
    – Dray Mck
    Nov 19 at 15:43










  • Dray Mck sure just give me an ideone.com link
    – johnathan
    Nov 19 at 15:46


















  • Hi, can you highlight the major changes you made, each along with a brief explanation or in-code comment? It's difficult to go through all the code looking for "what mistake I made" or "where I could improve on". Thanks!
    – TrebuchetMS
    Nov 19 at 15:01










  • To add, I only get this error when I am using dev c++, and the 3 functions you are referring to were implemented. Addroom() void reserveroom() void modifyroom()
    – Dray Mck
    Nov 19 at 15:35












  • Dray Mck they were not in the sample in your question. Read the comments on your post I'm not the only person that noticed that
    – johnathan
    Nov 19 at 15:37












  • Thats what I am saying. The program is a lot. . i should have removed the ones i didnt include in the question .if you want me to send the entire file i could
    – Dray Mck
    Nov 19 at 15:43










  • Dray Mck sure just give me an ideone.com link
    – johnathan
    Nov 19 at 15:46
















Hi, can you highlight the major changes you made, each along with a brief explanation or in-code comment? It's difficult to go through all the code looking for "what mistake I made" or "where I could improve on". Thanks!
– TrebuchetMS
Nov 19 at 15:01




Hi, can you highlight the major changes you made, each along with a brief explanation or in-code comment? It's difficult to go through all the code looking for "what mistake I made" or "where I could improve on". Thanks!
– TrebuchetMS
Nov 19 at 15:01












To add, I only get this error when I am using dev c++, and the 3 functions you are referring to were implemented. Addroom() void reserveroom() void modifyroom()
– Dray Mck
Nov 19 at 15:35






To add, I only get this error when I am using dev c++, and the 3 functions you are referring to were implemented. Addroom() void reserveroom() void modifyroom()
– Dray Mck
Nov 19 at 15:35














Dray Mck they were not in the sample in your question. Read the comments on your post I'm not the only person that noticed that
– johnathan
Nov 19 at 15:37






Dray Mck they were not in the sample in your question. Read the comments on your post I'm not the only person that noticed that
– johnathan
Nov 19 at 15:37














Thats what I am saying. The program is a lot. . i should have removed the ones i didnt include in the question .if you want me to send the entire file i could
– Dray Mck
Nov 19 at 15:43




Thats what I am saying. The program is a lot. . i should have removed the ones i didnt include in the question .if you want me to send the entire file i could
– Dray Mck
Nov 19 at 15:43












Dray Mck sure just give me an ideone.com link
– johnathan
Nov 19 at 15:46




Dray Mck sure just give me an ideone.com link
– johnathan
Nov 19 at 15:46










Dray Mck is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















Dray Mck is a new contributor. Be nice, and check out our Code of Conduct.













Dray Mck is a new contributor. Be nice, and check out our Code of Conduct.












Dray Mck is a new contributor. Be nice, and check out our Code of Conduct.















 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376361%2ferror-class-hotelroom-has-no-member-named-menu-even-though-it-is-there%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

Refactoring coordinates for Minecraft Pi buildings written in Python