I'm working on this program. There are 3 classes.
These two classes PassengerMenu and SecurityMenu are inherited from the class MainMenu
So the main menu would provide the logo and a description (normal cout). Also an access to either the passnger menu or the security menu. according to your choice.
The passenger menu has another stuff
The security menu has different stuff as well.
Now the whole program is going to be a loop.
How am I going to arrange them this way while they are inherited the easiest way???
I don't know.. It got complicated suddenly! Any suggestions?
This is the implementation for the main menu:
# include <iostream>
# include <string>
# include "MainMenu.h"
using namespace std;
MainMenu::MainMenu()
{
//body intentionally blank.
}
MainMenu::MainMenu(string the_name)
{
name=the_name;
}
MainMenu::MainMenu(string the_destanation, string the_departure, string the_date, string the_time)
{
destanation=the_destanation;
departure=the_departure;
date=the_date;
time=the_time;
}
ostream& operator << (ostream& outs,const MainMenu& settings)
{
outs<<settings.departure
<<settings.destanation
<<settings.date
<<settings.time;
return outs;
}
istream& operator >> (istream& ins,const MainMenu& settings)
{
ins >>settings.departure
>>settings.destanation;
return ins;
}
void MainMenu::display_main_menu ()const
{
int number;
do
{
cout<<"Hello and welcome to J-Otaku-Air travel agency."<<endl
<<"Please choose a number from the following menu, then press enter to "
<<"move to the desired page."<<endl<<endl
<<"1. About J-Otaku-Air"<<endl
<<"2. View passenger menu"<<endl
<<"3. View security menu"<<endl
<<"* Press 0 to exit"<<endl<<endl;
cin>> number;
if (number==1)
{
cout<<endl
<<"J-Otaku-Air was founded on July 1990."<<endl
<<"Fadia Banafe built this company with the goal of helping"<<endl
<<"accommodate the curious nature of people and their need for exploration. "<<endl
<<"Throuh out the years, J-Otaku-Air has been thriving to expand its services and"<<endl;
cout<<"offer the best for their clients. And along their journey their hard work has"<<endl
<<"been rewarded by many establishments."<<endl
<<"In hopes of seeing you in one of our flights."<<endl<<endl
<<"Sincerely,"
<<endl
<<" J-Otaku-Air"
<<"\t\t\t\t Fly Safe, Fly Otaku.."<<endl<<endl<<endl;
}
if (number==0)
"You're out of the main menu";
//if (number==2)
else
cout<<"Invalid entry!!"<<endl<<endl;
}while(number!=0);
}
string MainMenu::choose_from_main_menu (string choice)
{
cin>>choice;
return choice;
}
void MainMenu::JOTAKU_LOGO () const
{
cout << "\t\t\t ================= "<<endl;
cout << "\t\t\t || || || || "<<endl;
cout << "\t\t\t || || || || "<<endl;
cout << "\t\t\t || || || "<<endl;
cout << "\t\t\t \\ || || "<<endl;
cout << "\t\t\t \\ || "<<endl;
cout << "\t\t\t \\ || "<<endl;
cout << "\t\t\t \\|| J-Otaku-Air "<<endl;
cout <<endl;
cout <<endl;
}
void MainMenu::display_details()
{
cout << "Name: " << name << endl;
cout<<"destanation: " << destanation<<endl;
cout<<"departure: " << departure<<endl;
cout<<"date: "<<date<<endl;
cout<<"time: "<<time<<endl;
}