How to design a C++ project for a travel company infrastructure for booking seat?

Project Objective

How to design a C++ project for a travel company infrastructure for booking seat? This project is about bus traveling company in which if we want to reserve our seat, we online book our seat in bus at given time and if we want to cancel the reserved seat, we also able to unreserve the seat . this all purpose is online but what is behind that website is coding that I show in this project .  I use classes In this project ,one of the benefit of using classes is that we can protect our code through end user , in this project the main reason to use class is that to make code easy . I’m also using arrays for seat booking of multiple people and I’m also using filing to save my data .

Features of the Project

  1. Seat Booking
  2. Seat cancellation
  3. Bus schedule
  4. Revenue Report

It is a best way to book our seat online . This system has many advantages like we can reserve our seat at any time(given by company),from any where . As we know this is a computerized era so this project has many importance .

Explanation of project

  • This project uses Classes. In this project due to many reasons : first is that it make my code easier and due to classes we can make our own data type through which we can make objects which access data members and functions of class . In this project I’m using multiple member functions ,this make my code easier.
  • Also file handling is used  in this project to save our output permanently . File handling provides us feature to perform multiple functions on a code and to save it permanently.
  • I’m using arrays in this project because I want to save multiple persons data . As a bus have multiple seats and multiple people reserve seats in bus so for this achievement arrays are very helpful in programming.

C++ code for Design a C++ project for a travel company infrastructure for booking seat

#include<iostream>

#include<string>

using namespace std;

static int p=0;

class menue{  public:

int schedule;

int seat[40];

int nseat;

int revenue;

string Name[40];

string Cnic[40];

string date,time;

string bus_no;

string from;

string to;

void Bus_Schedule(void);

void first(void);

void second(void);

void third(void);

void fourth(void);

void input(void);

void show(void);

int Reserve_seat(menue[]);

void View_reserve(menue[]);

void View_unreserve(menue[]);

int cancel_seat(menue[]);

void total_revenue(menue[]);

};

void menue::input(){

cout<<“\nEnter schedule : “;

cin>>schedule;

cout << “\nEnter date : “;

cin >> date;

cout<<“\ntime : “;

cin>>time;

cout<<“\nEnter Bus Number : “;

cin>>bus_no;

cout << “\nFrom : “;

cin >> from;

cout << “\nTo : “;

cin >> to;

}

void menue::show(){

cout<<schedule<<“\t”<<date<<“\t”<<time<<“\t”<<from<<“\t”<<to<<“\t”<<bus_no<<endl;}

void menue::first(){

cout<<“\n1. View Schedule”<<endl;

cout<<“2. Enter Schedule”<<endl;

cout<<“3. Back Menue”<<endl;

cout<<“4. Exit”<<endl;                                      }

void menue::second(){

cout<<“\n1. Reserve seat”<<endl;

cout<<“2. View Reservation”<<endl;

cout<<“3. View UnResearved Seat”<<endl;

cout<<“4. Back Menue”<<endl;

cout<<“5. Exit”<<endl;

}

void menue::third(){

cout<<“\n1. View UnResearved Seat”<<endl;

cout<<“2. Cancel Seat Reservation”<<endl;

cout<<“3. Back Menue”<<endl;

cout<<“4. Exit”<<endl;}

void menue::fourth(){

cout  <<“\n1. Total Revenue Of A Bus”<<endl;

cout<<“2. Monthly Revenue Reservation”<<endl;

cout<<“3. Back Menue”<<endl;

cout<<“4. Exit”<<endl;}

void menue::Bus_Schedule(){

cout<<” \t Main Menu”;

cout<<“\n”; cout<<“1. Bus schedule”<<endl;

cout<<“2. Seat Book”<<endl;

cout<<“3. Seat Cancellation”<<endl;

cout<<“4. Revenue Reports”<<endl;cout<<“5. Exit\n”<<endl; }

void menue::total_revenue(menue obj[])

{ int schedulenumber,x,i;

bool busexist=false;

cout<<“Enter Bus schedule”<<endl;

cin>>schedulenumber;

for(int i=0;i<=p;i++){ if(schedulenumber==obj[i].schedule){  busexist=true;

x=i;   }   }

if(busexist)     {            cout<<“Schedule\t”<<“Bus\t”<<“Amount\t”<<endl;

cout<<obj[x].schedule<<“\t”<<obj[x].bus_no<<“\t”<<obj[x].nseat*580<<endl;    }

else{

cout<<“this number seat doesnot exits”<<endl;  } }

int menue::cancel_seat(menue obj[])    {    int number,schedulenumber,x;

bool busexist=false;

cout<<“Schedule:”;

cin>>schedulenumber;

for(int i=0;i<=p;i++){

if(schedulenumber==obj[i].schedule){     busexist=true;

x=i ;   }  }

if(busexist)   {

cout<<“\nSeat Number:”;

cin>>number;

if(number<40){

if(obj[x].seat[number]==1) {

obj[x].seat[number]=0;cout<<“Seat is cancelled”<<endl;

obj[x].nseat–;

return 0; }    else    {

cout<<“Seat is already unresearved you cannot cancel unreservedseat”<<endl;

return 0;   }}  else{

cout<<“this number seat doesnot exits”<<endl;

return 0;  } }

else {

cout<<“This schedule number doesnot exists”<<endl;

return 0;  }  }

int menue::Reserve_seat(menue obj[])

{

int number,schedulenumber,x;

bool busexist=false;

cout<<“Schedule:”;

cin>>schedulenumber;

for(int i=0;i<=p;i++){

if(schedulenumber==obj[i].schedule){

busexist=true;

x=i;}}

if(busexist){

 

cout<<“\nSeat Number:”;

cin>>number;

if(number<40){

if(obj[x].seat[number]!=1)

obj[x].seat[number]=1;

obj[x].nseat++;              }

else

{

cout<<“Seat Already reserved”<<endl;

return 0;

}

 

}

else{

cout<<“this number seat doesnot exits”<<endl;

return 0;

 

 

}

 

cout<<“\nName:”;

cin>>obj[x].Name[number];

cout<<“\nCNIC:”;

cin>>obj[x].Cnic[number];

cout<<“\n”;

return 0;

}

else{

cout<<“This schedule number doesnot exists”<<endl;

}

}

void menue::View_reserve(menue obj[])

{

int schedulenumber,x;

bool busexist=false;

cout<<“Enter Schedule:”;

cin>>schedulenumber;

for(int i=0;i<=p;i++){

if(schedulenumber==obj[i].schedule){

busexist=true;

x=i;

}

 

}

if(busexist)

{

cout<<“Schedule\t”<<“Seat Number\t”<<“Name\t”<<“CNIC”<<endl;

for(int i=0;i<40;i++){

if(obj[x].seat[i]!=0){

cout<<obj[x].schedule<<“\t”<<i+1<<“\t”<<obj[x].Name[i]<<“\t”<<obj[x].Cnic[i]<<endl;

}

 

}

}

 

else

{

cout<<“This schedule number doesnot exists”<<endl;

}

 

 

}

void menue:: View_unreserve(menue obj[]){

 

int schedulenumber,x;

bool busexist=false;

cout<<“Enter Schedule:”;

cin>>schedulenumber;

for(int i=0;i<=p;i++){

if(schedulenumber==obj[i].schedule){

busexist=true;

x=i;

}

 

}

if(busexist)

{

cout<<“Schedule\t”<<“Seat Number\t”<<endl;

for(int i=0;i<40;i++){

if(obj[x].seat[i]==0){

cout<<obj[x].schedule<<“\t”<<i+1<<endl;

}

 

}

}

 

else

{

cout<<“This schedule number doesnot exists”;

}

 

 

}

 

int main()

{

 

int press;

menue obj[100];

press=1;

int i=0;

while(press!=5){

 

obj[i].Bus_Schedule();

cin>>press;

if(press==1)

{

obj[i].first();

cin>>press;

if(press==1)

{

cout<<“schedule”<<“\t”<<“date”<<“\t”<<“time”<<“\t”<<“from”<<“\t”<<“to”<<“\t”<<“bus_no”<<endl;

for(int i=0;i<p;i++)

obj[i].show();

}

if(press==2)

{

 

obj[i].input();

p++;

}

if(press==3){

continue;

}

if(press==4){

break;

}

 

}

 

 

else if(press==2)

{

obj[i].second();

cin>>press;

if(press==1){

obj[i].Reserve_seat(obj);

}

if(press==2){

obj[i].View_reserve(obj);

}

if(press==3){

obj[i].View_unreserve(obj);

}

if(press==4){

continue;

}

if(press==5)

{

break;

}

 

}

else if(press==3)

{

obj[i].third();

cin>>press;

if(press==1){

obj[i].View_unreserve(obj);

}

if(press==2){

obj[i].cancel_seat(obj);

}

if(press==3){

continue;

}

if(press==4){

break;

}

 

}

 

else if(press==4)

{

obj[i].fourth();

cin>>press;

if(press==1){

obj[i].total_revenue(obj);

}

if(press==2){

obj[i].cancel_seat(obj);

}

if(press==3){

continue;

}

if(press==4){

break;

}

}

else if (press==5)

{

break;

}

else

cout<<“Enter valid number”;

i++;

}

return 0;

}

Also read here for more projects in c++

https://eevibes.com/engineering-projects/

Leave a Reply

Your email address will not be published. Required fields are marked *