Seats
//a program that select seats for the client.
#include<iostream>
using namespace std;
class Airline
{
private: int choice;
private: int passenger;
private: int seats[12];
private: int Business_seat;
private: int Economy_seat;
public: void reserve()
{
passenger=0;
Business_seat=0;
Economy_seat=6;
while (passenger <12)
{
cout<<"\t*****Airline company*****\n\n";
cout<<"\t*****Helicopter class menu******\n\n";
cout<<"\tDesigned by: Peter Kibet Brian\n\n";
cout<<"\tReg no: s08-6317-2020\n\n";
cout<<"\tEnter 1 to reserve a seat in Business Class.\n";
cout<<"\tEnter 2 to reserve a seat in Economy Class.\n";
cout<<"\tPlease select the class of your choice: \n";
cin>>choice;
if (choice == 1)
{
if(Business_seat<=5)
{
seats[Business_seat]=1;
Business_seat++;
passenger++;
cout<<"\nClass: Business"<<endl;
cout<<"\nYou have been assigned Seat Number: "<<Business_seat<<endl;
}
else
{
cout<<"\nBusiness Seats are Fully reserved. Please select 2 for Economy seats."<<endl;
}
}
else if (choice == 2)
{
if(Economy_seat>=6 && Economy_seat<12)
{
seats[Economy_seat]=1;
Economy_seat++;
passenger++;
cout<<"\tClass: Economy"<<endl;
cout<<"\tYou have been assigned Seat Number: "<<Economy_seat<<endl;
}
else
{
cout<<"\tEconomy Side Seats are Full. Please select 1 for Business seats. "<<endl;
}
}
}
if(seats[0]==1 && seats[1]==1 && seats[2]==1 && seats[3]==1 && seats[4]==1 && seats[5]==1 && seats[6]==1&& seats[7]==1 && seats[8]==1 && seats[9]==1 && seats[10]==1 && seats[11]==1)
{
cout<<"\tThis Flight is FULLY reserved!!!\n";
cout<<"\tSorry. Please wait for The Next Flight that leaves in 5 hours\n";
}
}
};
int main()
{
Airline A;
A.reserve();
return 0;
}