Advanced Airline Management system using data structures and OOP in c++

 

Information about Management system:

Introduction:

This project is about the airline management system and now I will make a simple introduction to this project which is that what is an airline management system to talk about this firstly I will tell that what is management system so management system is something like a program which manage the record of the company or organization. It helps to calculate, manage, or make record the data by different operations. So, I will make a management system of airline tickets that if a customer reserve a ticket than the data of this customer will store inside the program and in this way, we can make a record and this record can help us to check that which customer reserve the ticket from our organization or company and this can save a lot of the time of us. And the main point is the whole project is based on the binary search tree (BST) because is algorithm faster than most of the algorithms. And how this algorithm works and the answer is while storing the information this algorithm stores the information by in this manner than if the number is smaller than the previous number than it will store at the left of that number and if the number will greater than the number will save at the right of that number.

So, this was the simple introduction for our management system.

Scope of this Airline Management system:

Scope of the airline management system is that, this can help the customer to check the availability of the flight where a customer can reserve the ticket, cancel the ticket, modify the ticket or check the ticket. So, this is the scope for the airline management system.

Functionality:

This management system will hold the complete record of the customer who will reserve or cancel the ticket. So, the functionality of this airline management system is following:

Reserve the Ticket:

In this function one may reserve the ticket. This is totally beneficial for the company because it will save your lot of the time and how this function will work, I will tell you so when a user reserves the ticket than information will store in such a way that if the last number will greater than the previous number than information will store at the right of the binary tree and if the number will less than the last number than information will store at the left of the tree.

Cancel the ticket:

In this function if the user reserved the ticket than by using this function, he can cancel the ticket. So, how this function will work and the answer is this for example if the ticket numbers are these 5 4 6 7 and user want to cancel the 4 number ticket than this function will transverse at the first node than compare that number with the expected number and this number is not equal to that number so this function will transverse at the left of the tree and now it will compare the 4 number with that number and now number is equal to that expected and now this function will delete that complete node and how it will heal the remaining nodes which can be attach to that node which is deleted so the answer is this, if the expected number will 5 which we want to delete than we will find that number and transverse the root to that node than find the greatest number at the left of the tree after finding that number we will swap the data of both the nodes than we will delete the founded node.

So, this function is little bit tricky and in this way this function works.

Show the whole tickets:

In this function we will show the complete information which is stored inside the tree. In this function there are three ways to show the tickets.

In-order Transversal:

In this transversal we will show the data of the left node than show the data of root node and show the data of the right node.

Pre-order transversal:

In this transversal, function will show the data of the root node first than show the data of the left node than right node.

Post-order transversal:

In this transversal, function will show the data of the left node than right node than root node.

Search the Ticket:

In this function we will find the expected ticket to check data about that ticket so the functionality of this function about the same as the delete ticket function but in this function, we will not delete the data but at the place of delete we will check the data about that ticket.

Modify the tickets:

So, in function we will modify the data of expected ticket. So how this function works and the answer is this first we will find the node or ticket number of expected node then we will modify the data of that ticket.

Print ticket:

In this function we can print the ticket of the expected passenger and how this will work first of all we will find the ticket number of the passenger and make a ticket of that person this function is something like the search function but the major difference in this function is in search function we were show the data of that person but in this function, we will make a ticket of the that person and user can also print out the ticket of that person.

So, in this way this function works.

Display Airplane:

                           By using this functionality I will display the airplanes which are the part of my airport.

Reserved Airlines:

                       By using this functionality we can check that which airplane is reserved.

Classes:

               I made the six classes for this project and the name of them is following:

Seats:

             I used this class to add the seats inside the airplane and this class will make a composition with the Airplane class.

Passenger:

                      I made the passenger class to save the data of the passenger and this class will make aggregation with the airline class.

Airline:

               I made the Airline class and make aggregation by passenger after this I will make the binary tree using this class and store the data about the passenger inside the Passenger class using a object.

Plane:

              I made this class to store the information about the plane and I made the aggregation with airplane class.

Airplane:

                 I made this class and made composition by seats and made aggregation by plane class and I will store the data inside the plane class by using this class and I will make the binary tree using this class.

Airpot:

I made this class and made the association by airline class and made composition by airplane class and also I used this class to implement the function inside this class.  And I made a class diagram for further information.

 

Class Diagram:

Airline Management system class diagram



Code:

NOTE: You can also move the editor.

       

#include<iostream>

#include<string>

#include<cstring>

#include<algorithm>

#include<Windows.h>

using namespace std;

#define size 50

class Seats

{

public:

                int seats[size];

                int reserved = 0;

};

class Pessenger{

public:

                int ticketNo;

                string name;

                string cnic;

                string Adress;

                string PhoenNo;

};

class Airline{

public:

                Pessenger p1;

                Airline *left;

                Airline *right;

};

class Plane{

public:

                int planeNo;

                string destination;

                string planeName;

                string arival;

                string depart;

                Airline a;

                Seats s1;

};

class Airplane{

public:

                Plane p1;

                Airline *AirlineRoot = NULL;

                Airplane *left;

                Airplane *right;

};

class Airpot{

public:

                Airplane *AirplaneRoot = NULL;

                Airline *insert(Airline *temp, int T, string N, string Cnic, string Addr, string PN)

                {

                                if (temp == NULL){

                                                Airline *newNode = new Airline;

                                                newNode->p1.name = N;

                                                newNode->p1.cnic = Cnic;

                                                newNode->p1.Adress = Addr;

                                                newNode->p1.PhoenNo = PN;

                                                newNode->p1.ticketNo = T;

                                                newNode->left = newNode->right = NULL;

                                                temp = newNode;

                                }

                                else if (temp->p1.ticketNo > T)

                                {

                                                temp->left = insert(temp->left, T, N, Cnic, Addr, PN);

                                }

                                else

                                {

                                                temp->right = insert(temp->right, T, N, Cnic, Addr, PN);

                                }

                                return temp;

                }

                Airplane *insertPlane(Airplane *temp, int No, string Name, string Arr, string Dep, string des)

                {

                                if (temp == NULL){

                                                Airplane *newNode = new Airplane;

                                                newNode->p1.planeNo = No;

                                                newNode->p1.planeName = Name;

                                                newNode->p1.arival = Arr;

                                                newNode->p1.depart = Dep;

                                                newNode->p1.destination = des;

                                                newNode->left = newNode->right = NULL;

                                                temp = newNode;

                                }

                                else if (temp->p1.planeNo > No)

                                {

                                                temp->left = insertPlane(temp->left, No, Name, Arr, Dep, des);

                                }

                                else

                                {

                                                temp->right = insertPlane(temp->right, No, Name, Arr, Dep, des);

                                }

                                return temp;

                }

                void DispPessengers(Airline *temp)

                {

                                cout << endl;

                                if (temp != NULL)

                                {

                                                DispPessengers(temp->left);

                                                cout << "\\\\\\\\\\\\\\\\\\\\Pessenger Detail\\\\\\\\\\\\\\\\\\\\" << endl;

                                                cout << "Ticket number of this pessenger is:" << temp->p1.ticketNo << endl;

                                                cout << "Name of this pessenger is:" << temp->p1.name << endl;

                                                cout << "Address of this pessenger is:" << temp->p1.Adress << endl;

                                                cout << "CNIC of this pessenger is:" << temp->p1.cnic << endl;

                                                cout << "Phone number of this pessenger is:" << temp->p1.PhoenNo << endl;

                                                cout << "********************" << endl;

                                                getchar();

                                                getchar();

                                                DispPessengers(temp->right);

                                                cout << endl << endl;

                                }

                }

                void DispPlanes(Airplane *temp)

                {

                                cout << endl;

                                if (temp != NULL)

                                {

                                                DispPlanes(temp->left);

                                                cout << "--------------------Airline Details----------------------" << endl;

                                                cout << "PLane number is:" << temp->p1.planeNo << endl;

                                                cout << "Plane name is:" << temp->p1.planeName << endl;

                                                cout << "Plane Arrival time is:" << temp->p1.arival << endl;

                                                cout << "Plane Depart time is:" << temp->p1.depart << endl;

                                                cout << "Plane reserved seats:" << temp->p1.s1.reserved << endl;

                                                cout << "********************" << endl;

                                                getchar();

                                                getchar();

                                                DispPlanes(temp->right);

                                                cout << endl << endl;

                                }

                }

                void DispTickets(Airline *temp, Airplane *temp2)

                {

                                cout << endl;

                                if (temp != NULL)

                                {

                                                DispTickets(temp->left, temp2);

                                                cout << "******These Tickets are availablae******" << endl;

                                                cout << "--------------------Airline Detail----------------------" << endl;

                                                cout << "Airline Number is:" << temp2->p1.planeNo << endl;

                                                cout << "Airline name is:" << temp2->p1.planeName << endl;

                                                cout << "Airline Arrival time is:" << temp2->p1.arival << endl;

                                                cout << "Airline Departure time is:" << temp2->p1.depart << endl;

                                                cout << "Airline Destination is:" << temp2->p1.destination << endl;

                                                cout << "\\\\\\\\\\\\\\\\\\\\Pessenger Detail\\\\\\\\\\\\\\\\\\\\" << endl;

                                                cout << "Ticket number of this pessenger is:" << temp->p1.ticketNo << endl;

                                                cout << "Name of this pessenger is:" << temp->p1.name << endl;

                                                cout << "Address of this pessenger is:" << temp->p1.Adress << endl;

                                                cout << "CNIC of this pessenger is:" << temp->p1.cnic << endl;

                                                cout << "Phone number of this pessenger is:" << temp->p1.PhoenNo << endl;

                                                cout << "********************" << endl;

                                                getchar();

                                                getchar();

                                                DispTickets(temp->right, temp2);

                                                cout << endl << endl;

                                }

                }

                Airline *minVal(Airline *node)

                {

                                Airline *current = node;

                                while (current->left != NULL)

                                                current = current->left;

 

                                return current;

                }

                Airline *Del(Airline *temp, int T)

                {

                                if (temp == NULL)

                                {

                                                return NULL;

                                }

                                else if (temp->p1.ticketNo > T)

                                {

                                                temp->left = Del(temp->left, T);

                                }

                                else if (temp->p1.ticketNo < T)

                                {

                                                temp->right = Del(temp->right, T);

                                }

                                else {

                                                if (temp->left == NULL)

                                                {

                                                                Airline *stemp = temp->right;

                                                                delete(temp);

                                                                return stemp;

                                                }

                                                else if (temp->right == NULL)

                                                {

                                                                Airline *stemp = temp->left;

                                                                delete(temp);

                                                                return stemp;

                                                }

                                                Airline *stemp = minVal(temp->right);

                                                temp->p1.ticketNo = stemp->p1.ticketNo;

                                                temp->right = Del(temp->right, stemp->p1.ticketNo);

                                }

                                return temp;

                }

                void Search(Airline *temp, int T, Airplane *temp2)

                {

                                if (temp == NULL)

                                {

                                                cout << "This ticket is not found" << endl;

                                                system("pause");

                                }

                                else if (temp->p1.ticketNo == T)

                                {

                                                cout << "******Check the ticket and print it******" << endl;

                                                cout << "--------------------Airline Detail----------------------" << endl;

                                                cout << "Airline Number is:" << temp2->p1.planeNo << endl;

                                                cout << "Airline name is:" << temp2->p1.planeName << endl;

                                                cout << "Airline Arrival time is:" << temp2->p1.arival << endl;

                                                cout << "Airline Departure time is:" << temp2->p1.depart << endl;

                                                cout << "Airline Destination is:" << temp2->p1.destination << endl;

                                                cout << "\\\\\\\\\\\\\\\\\\\\Pessenger Detail\\\\\\\\\\\\\\\\\\\\" << endl;

                                                cout << "Ticket number of this pessenger is:" << temp->p1.ticketNo << endl;

                                                cout << "Name of this pessenger is:" << temp->p1.name << endl;

                                                cout << "Address of this pessenger is:" << temp->p1.Adress << endl;

                                                cout << "CNIC of this pessenger is:" << temp->p1.cnic << endl;

                                                cout << "Phone number of this pessenger is:" << temp->p1.PhoenNo << endl;

                                                cout << "********************" << endl;

                                                getchar();

                                                getchar();

                                }

                                else if (temp->p1.ticketNo <= T)

                                {

                                                Search(temp->right, T, temp2);

                                }

                                else

                                {

                                                Search(temp->left, T, temp2);

                                }

                }

                void Update(Airline *temp, int T)

                {

 

                                if (temp == NULL)

                                {

                                                cout << "This ticket is not found" << endl;

                                                system("pause");

                                }

                                else if (temp->p1.ticketNo == T)

                                {

                                                system("pause");

                                                cout << "Enter the name to update for ticket no " << temp->p1.ticketNo << ":";

                                                getline(cin, temp->p1.name);

                                                cout << "Enter the Adress to updatae for ticket no " << temp->p1.ticketNo << ";";

                                                getline(cin, temp->p1.Adress);

                                                cout << "Enter the CNIC to update for ticket no " << temp->p1.ticketNo << ":";

                                                getline(cin, temp->p1.cnic);

                                                cout << "Enter the Phone to updatae for ticket no " << temp->p1.ticketNo << ";";

                                                getline(cin, temp->p1.PhoenNo);

                                }

                                else if (temp->p1.ticketNo <= T)

                                {

                                                Update(temp->right, T);

                                }

                                else

                                {

                                                Update(temp->left, T);

                                }

                }

                int checkSeats(Airplane *temp, int TNo)

                {

                                int count = 0, verifyBack = 0;

                                for (int i = 0; i < temp->p1.s1.reserved; i++)

                                {

                                                if (temp->p1.s1.seats[i] == TNo)

                                                {

                                                                cout << "Sorry!!! please Enter another Seat" << endl;

                                                                cout << "Because This Seat is Reserved already" << endl;

                                                                cout << "Total seats are 49" << endl;

                                                                count++;

                                                                getchar();

                                                                getchar();

                                                                break;

                                                }

                                }

                                if (count == 0)

                                {

                                                cout << "Your Ticket is Reserved Successfully" << endl;

                                                getchar();

                                                getchar();

                                                verifyBack = 1;

                                                temp->p1.s1.seats[temp->p1.s1.reserved] = TNo;

                                                temp->p1.s1.reserved++;

                                }

                                return verifyBack;

                }

                Airplane *SearchFlight(Airplane *temp, int PlaneNo)

                {

                                if (temp != NULL){

                                                while (temp != NULL)

                                                {

                                                                if (temp->p1.planeNo == PlaneNo)

                                                                {

                                                                                break;

                                                                }

                                                                else if (temp->p1.planeNo == PlaneNo)

                                                                {

                                                                                temp = temp->right;

                                                                }

                                                                else

                                                                {

                                                                                temp = temp->left;

                                                                }

                                                }

                                }

                                return temp;

                }

                void RemoveSeat(int T, Airplane *temp)

                {

                                int tempVar; int count = 0;

                                for (int i = 0; i < temp->p1.s1.reserved; i++)

                                {

                                                if (temp->p1.s1.seats[i] == T)

                                                {

                                                                tempVar = temp->p1.s1.seats[i];

                                                                temp->p1.s1.seats[i] = temp->p1.s1.seats[temp->p1.s1.reserved];

                                                                temp->p1.s1.seats[temp->p1.s1.reserved] = tempVar;

                                                                cout << "Seat No " << temp->p1.s1.seats[temp->p1.s1.reserved] << " is removing from Plane No " << temp->p1.planeNo << endl;

                                                                getchar();

                                                                getchar();

                                                                temp->p1.s1.reserved--;

                                                                count++;

                                                }

                                }

                                if (count == 0)

                                {

                                                cout << "Sorry!!! This Ticket is not found" << endl;

                                                getchar();

                                                getchar();

                                }

                }

 

};

int main()

{

 

                Airpot *planeObj = new Airpot;

                Airplane *temp;

                int PNo, desNo, des2;

                string pname, parr, pdep, des; int verify = 0;

                int option = 0, option2 = 0, tk, off = 0, c = 0, yes = 0;

                int status1 = 0, status2 = 0, status3 = 0, status4 = 0, status5 = 0, status6 = 0;

                int plan1 = 0, plan2 = 0, plan3 = 0, plan4 = 0, plan5 = 0, plan6 = 0;

                string nm, ad, cnic, ph, email = "Abdul Wahab", password, access = "ABDULWAHAB";

                cout << endl << endl << endl << endl << endl << endl << endl;

                cout << "                       WELLCOME TO AIRLINE MANAGEMENT SYSTEM                     " << endl;

                Sleep(2000);

                system("cls");

                cout << endl << endl << endl << endl << endl << endl << endl;

                cout << "                             WE WERE WAITING FOR YOU                     " << endl;

                Sleep(2000);

                cout << endl << endl << endl << endl << endl << endl << endl;

                cout << "                            lets start the new journey                     " << endl;

                Sleep(2000);

                system("cls");

                cout << endl << endl << endl;

                cout << "                                    Credit                    " << endl;

                Sleep(2000);

                cout << endl << endl << endl << endl << endl;

                cout << "                                Abdul Wahab Raza                     " << endl;

                Sleep(2000);

                cout << endl << endl << endl;

                cout << "                                  Bilal Zahid                     " << endl;

                Sleep(2000);

                cout << endl << endl << endl;

                cout << "                                   Adnan Ali                    " << endl;

                Sleep(2000);

                if (c <10){

                                while (off != 1){

                                                system("cls");

                                                cout << "*******Press 1 to close*******" << endl << endl;

                                                cout << "Email of the Management system is " << email << endl;

                                                cout << "Enter password(Both upper and lower case works in password)" << endl;

                                                getline(cin, password);

                                                if (password == "1")

                                                {

                                                                off = 1;

                                                                break;

                                                }

                                                transform(password.begin(), password.end(), password.begin(), toupper);

                                                option2 = 0;

                                                if (password == access){

                                                                c = 0;

                                                                option = 0;

                                                                while (option2 != 10){

                                                                                system("cls");

                                                                                cout << "******WELLCOME TO RAZA FLIGHTS Company*****" << endl;

                                                                                cout << "Press 1 for local flights" << endl;

                                                                                cout << "Press 2 for Global flights" << endl;

                                                                                cout << "Press 10 to cancel ";

                                                                                cin >> desNo;

                                                                                if (desNo == 1)

                                                                                {

                                                                                                cout << "****These flights are available****" << endl;

                                                                                                cout << "1) Lahore            2)Islamabad         3)Karachi" << endl;

                                                                                                cout << "Please Press the option by number(int):";

                                                                                                cin >> des2; cin.ignore();

                                                                                                if (des2 == 1)

                                                                                                {

                                                                                                                yes = 1;

                                                                                                                PNo = 1;

                                                                                                                pname = "PIA";

                                                                                                                parr = "3 AM";

                                                                                                                pdep = "6 AM";

                                                                                                                des = "Lahore";

                                                                                                                if (plan1 == 0)

                                                                                                                {

                                                                                                                                planeObj->AirplaneRoot = planeObj->insertPlane(planeObj->AirplaneRoot, PNo, pname, parr, pdep, des);

                                                                                                                                cout << "Yes, Seats are available in this flight" << endl;

                                                                                                                                option2 = 10;

                                                                                                                                plan1++;

                                                                                                                                getchar();

                                                                                                                                getchar();

                                                                                                                }

                                                                                                                else

                                                                                                                {

                                                                                                                                plan1++;

 

                                                                                                                                if (plan1 > size - 1)

                                                                                                                                {

 

                                                                                                                                                cout << "This plan is full now" << endl;

                                                                                                                                                cout << "We cannot add more pessengers in this plan" << endl;

                                                                                                                                                getchar();

                                                                                                                                                getchar();

                                                                                                                                }

                                                                                                                                else

                                                                                                                                {

                                                                                                                                                cout << "Yes, Seats are available in this flight" << endl;

                                                                                                                                                option2 = 10;

                                                                                                                                                getchar();

                                                                                                                                                getchar();

                                                                                                                                }

                                                                                                                }

                                                                                                }

                                                                                                else if (des2 == 2)

                                                                                                {

                                                                                                                yes = 1;

                                                                                                                PNo = 2;

                                                                                                                pname = "PIA";

                                                                                                                parr = "10 PM";

                                                                                                                pdep = "12 AM";

                                                                                                                des = "Islamabad";

                                                                                                                if (plan2 == 0)

                                                                                                                {

                                                                                                                                planeObj->AirplaneRoot = planeObj->insertPlane(planeObj->AirplaneRoot, PNo, pname, parr, pdep, des);

                                                                                                                                plan2++;

                                                                                                                                cout << "Yes, Seats are available in this flight" << endl;

 

                                                                                                                                getchar();

                                                                                                                                getchar();

                                                                                                                                option2 = 10;

                                                                                                                }

                                                                                                                else

                                                                                                                {

                                                                                                                                plan2++;

 

                                                                                                                                if (plan2 > size - 1)

                                                                                                                                {

 

                                                                                                                                                cout << "This plan is full now" << endl;

                                                                                                                                                cout << "We cannot add more pessengers in this plan" << endl;

                                                                                                                                                getchar(); getchar();

                                                                                                                                }

                                                                                                                                else

                                                                                                                                {

                                                                                                                                                cout << "Yes, Seats are available in this flight" << endl;

                                                                                                                                                getchar();

                                                                                                                                                getchar();

                                                                                                                                                option2 = 10;

                                                                                                                                }

                                                                                                                }

                                                                                                }

                                                                                                else if (des2 == 3)

                                                                                                {

                                                                                                                yes = 1;

                                                                                                                PNo = 3;

                                                                                                                pname = "PIA";

                                                                                                                parr = "8 PM";

                                                                                                                pdep = "10 PM";

                                                                                                                des = "Karachi";

                                                                                                                if (plan3 == 0)

                                                                                                                {

                                                                                                                                planeObj->AirplaneRoot = planeObj->insertPlane(planeObj->AirplaneRoot, PNo, pname, parr, pdep, des);

                                                                                                                                cout << "Yes, Seats are available in this flight" << endl;

                                                                                                                                plan3++;

 

                                                                                                                                getchar();

                                                                                                                                getchar();

                                                                                                                                option2 = 10;

                                                                                                                }

                                                                                                                else

                                                                                                                {

                                                                                                                                plan3++;

 

                                                                                                                                if (plan3 > size - 1)

                                                                                                                                {

 

                                                                                                                                                cout << "This plan is full now" << endl;

                                                                                                                                                cout << "We cannot add more pessengers in this plan" << endl;

                                                                                                                                                getchar();

                                                                                                                                                getchar();

                                                                                                                                }

                                                                                                                                else

                                                                                                                                {

                                                                                                                                                cout << "Yes, Seats are available in this flight" << endl;

                                                                                                                                                getchar();

                                                                                                                                                getchar();

                                                                                                                                                option2 = 10;

                                                                                                                                }

                                                                                                                }

                                                                                                }

                                                                                                else

                                                                                                {

                                                                                                                cout << "Sorry, this option is not available" << endl;

                                                                                                                cout << "But we are working to grow our company" << endl;

                                                                                                                yes = 0;

                                                                                                                getchar();

                                                                                                                getchar();

                                                                                                }

                                                                                }

                                                                                else if (desNo == 2)

                                                                                {

 

                                                                                                cout << "****These flights are available****" << endl;

                                                                                                cout << "1) London(UK)            2)Dubai         3)Paris(France)" << endl;

                                                                                                cout << "Please Press the option by number(int):";

                                                                                                cin >> des2; cin.ignore();

                                                                                                if (des2 == 1)

                                                                                                {

                                                                                                                yes = 1;

                                                                                                                PNo = 4;

                                                                                                                pname = "Jet2";

                                                                                                                parr = "10 PM";

                                                                                                                pdep = "12 AM";

                                                                                                                des = "London (UK)";

                                                                                                                if (plan4 == 0)

                                                                                                                {

                                                                                                                                planeObj->AirplaneRoot = planeObj->insertPlane(planeObj->AirplaneRoot, PNo, pname, parr, pdep, des);

                                                                                                                                cout << "Yes, Seats are avilable in this flight!!!" << endl;

                                                                                                                                plan4++;

 

                                                                                                                                getchar();

                                                                                                                                getchar();

                                                                                                                                option2 = 10;

                                                                                                                }

                                                                                                                else

                                                                                                                {

                                                                                                                                plan4++;

 

                                                                                                                                if (plan4 > size - 1)

                                                                                                                                {

 

                                                                                                                                                cout << "This plan is full now" << endl;

                                                                                                                                                cout << "We cannot add more pessengers in this plan" << endl;

                                                                                                                                                getchar();

                                                                                                                                                getchar();

                                                                                                                                }

                                                                                                                                else

                                                                                                                                {

                                                                                                                                                cout << "Yes, Seats are available in this flight" << endl;

                                                                                                                                                getchar();

                                                                                                                                                getchar();

                                                                                                                                                option2 = 10;

                                                                                                                                }

                                                                                                                }

                                                                                                }

                                                                                                else if (des2 == 2)

                                                                                                {

                                                                                                                yes = 1;

                                                                                                                PNo = 5;

                                                                                                                pname = "Emirates";

                                                                                                                parr = "9 AM";

                                                                                                                pdep = "12 PM";

                                                                                                                des = "UAE(Dubai)";

                                                                                                                if (plan5 == 0)

                                                                                                                {

                                                                                                                                planeObj->AirplaneRoot = planeObj->insertPlane(planeObj->AirplaneRoot, PNo, pname, parr, pdep, des);

                                                                                                                                cout << "Yes, Seats are available in this flight" << endl;

                                                                                                                                plan5++;

                                                                                                                                getchar();

                                                                                                                                getchar();

                                                                                                                                option2 = 10;

                                                                                                                }

                                                                                                                else

                                                                                                                {

                                                                                                                                plan5++;

                                                                                                                                if (plan5 > size - 1)

                                                                                                                                {

 

                                                                                                                                                cout << "This plan is full now" << endl;

                                                                                                                                                cout << "We cannot add more pessengers in this plan" << endl;

                                                                                                                                                getchar();

                                                                                                                                                getchar();

                                                                                                                                }

                                                                                                                                else

                                                                                                                                {

                                                                                                                                                cout << "Yes, Seats are available in this flight" << endl;

                                                                                                                                                getchar();

                                                                                                                                                getchar();

                                                                                                                                                option2 = 10;

                                                                                                                                }

                                                                                                                }

                                                                                                }

                                                                                                else if (des2 == 3)

                                                                                                {

                                                                                                                PNo = 6;

                                                                                                                yes = 1;

                                                                                                                pname = "AirFrance";

                                                                                                                parr = "8 PM";

                                                                                                                pdep = "10 PM";

                                                                                                                des = "France (Paris)";

                                                                                                                if (plan6 == 0)

                                                                                                                {

                                                                                                                                planeObj->AirplaneRoot = planeObj->insertPlane(planeObj->AirplaneRoot, PNo, pname, parr, pdep, des);

                                                                                                                                cout << "Yes, Seats are available in this flight" << endl;

                                                                                                                                plan6++;

 

                                                                                                                                getchar();

                                                                                                                                getchar();

                                                                                                                                option2 = 10;

                                                                                                                }

                                                                                                                else

                                                                                                                {

                                                                                                                                plan6++;

 

                                                                                                                                if (plan6 > size - 1)

                                                                                                                                {

 

                                                                                                                                                cout << "This plan is full now" << endl;

                                                                                                                                                cout << "We cannot add more pessengers in this plan" << endl;

                                                                                                                                                getchar();

                                                                                                                                                getchar();

                                                                                                                                }

                                                                                                                                else

                                                                                                                                {

                                                                                                                                                cout << "Yes, Seats are available in this flight" << endl;

                                                                                                                                                getchar();

                                                                                                                                                getchar();

                                                                                                                                                option2 = 10;

                                                                                                                                }

                                                                                                                }

                                                                                                }

                                                                                                else

                                                                                                {

                                                                                                                cout << "Sorry, this option is not available" << endl;

                                                                                                                cout << "But we are working to grow our company" << endl;

                                                                                                                yes = 0;

                                                                                                                getchar();

                                                                                                                getchar();

                                                                                                }

                                                                                }

                                                                                else if (desNo == 10)

                                                                                {

                                                                                                option2 = 10;

                                                                                               

                                                                                                cout << "Thank you So Much for our Services" << endl;

                                                                                                yes = 0;

                                                                                                getchar();

                                                                                                getchar();

                                                                                                break;

                                                                                }

                                                                                else

                                                                                {

                                                                                                cout << "This option is not available" << endl;

                                                                                                yes = 0;

                                                                                                getchar();

                                                                                                getchar();

                                                                                }

                                                               

                                                                if (yes == 1){

                                                                                while (option != 10){

                                                                                                system("cls");

 

                                                                                                cout << "****Please Enter data to Reserve the ticket****" << endl;

                                                                                                cout << "Please Enter 1 to insert the ticket" << endl;

                                                                                                cout << "Please Enter 2 to Show this Flight pessenger" << endl;

                                                                                                cout << "Please Enter 3 to Delete the ticket" << endl;

                                                                                                cout << "Please Enter 4 to Search the ticket" << endl;

                                                                                                cout << "Please Enter 5 to Update the ticket" << endl;

                                                                                                cout << "Enter 6 to show Reserved flights" << endl;

                                                                                                cout << "Enter 7 to show available flights" << endl;

                                                                                                cout << "Please Enter 10 to Close this flight" << endl;

                                                                                                cin >> option; cin.ignore();

                                                                                                switch (option)

                                                                                                {

                                                                                                case 1:

                                                                                                                while (verify != 1){

                                                                                                                                cout << "Please Enter the Seat number to reserve:" << endl;

                                                                                                                                cin >> tk; cin.ignore();

                                                                                                                                verify = planeObj->checkSeats(planeObj->AirplaneRoot, tk);

                                                                                                                }

                                                                                                                verify = 0;

                                                                                                                cout << "Please Enter the name:"; getline(cin, nm);

                                                                                                                cout << "Please Enter the adress:"; getline(cin, ad);

                                                                                                                cout << "Please Enter the CNIC:"; getline(cin, cnic);

                                                                                                                cout << "Please Enter the phone number:"; getline(cin, ph);

                                                                                                                temp = planeObj->SearchFlight(planeObj->AirplaneRoot, PNo);

                                                                                                                if (temp == NULL){

                                                                                                                                cout << "Sorry!! Flight cannt found" << endl;

                                                                                                                }

                                                                                                                else

                                                                                                                                temp->AirlineRoot = planeObj->insert(temp->AirlineRoot, tk, nm, cnic, ad, ph);

                                                                                                                system("cls");

                                                                                                                temp = planeObj->SearchFlight(planeObj->AirplaneRoot, PNo);

                                                                                                                if (temp == NULL){

                                                                                                                                cout << "Sorry!! Flight cannt found" << endl;

                                                                                                                }

                                                                                                                else

                                                                                                                                planeObj->Search(temp->AirlineRoot, tk, temp);

                                                                                                                break;

                                                                                                case 2:

                                                                                                                temp = planeObj->SearchFlight(planeObj->AirplaneRoot, PNo);

                                                                                                                system("cls");

                                                                                                                if (temp == NULL){

                                                                                                                                cout << "Sorry!! Flight cannt found" << endl;

                                                                                                                }

                                                                                                                else

                                                                                                                                planeObj->DispTickets(temp->AirlineRoot, temp);

                                                                                                                break;

                                                                                                case 3:{

                                                                                                                                   cout << "Please Enter the ticket number to delete;"; cin >> tk; cin.ignore();

                                                                                                                                   planeObj->RemoveSeat(tk, planeObj->AirplaneRoot);

                                                                                                                                   temp = planeObj->SearchFlight(planeObj->AirplaneRoot, PNo);

                                                                                                                                   if (temp == NULL){

                                                                                                                                                   cout << "Sorry!! Flight cannt found" << endl;

                                                                                                                                   }

                                                                                                                                   else

                                                                                                                                                   temp->AirlineRoot = planeObj->Del(temp->AirlineRoot, tk);

 

                                                                                                                                   break;

                                                                                                }

                                                                                                case 4:{

                                                                                                                                   cout << "Please Enter the ticket number to search:"; cin >> tk; cin.ignore();

                                                                                                                                   temp = planeObj->SearchFlight(planeObj->AirplaneRoot, PNo);

                                                                                                                                   if (temp == NULL){

                                                                                                                                                   cout << "Sorry!! Flight cannt found" << endl;

                                                                                                                                   }

                                                                                                                                   else

                                                                                                                                                   planeObj->Search(temp->AirlineRoot, tk, temp);

                                                                                                                                   break;

                                                                                                }

                                                                                                case 5:{

                                                                                                                                   cout << "Please Enter the ticket number to Update:"; cin >> tk; cin.ignore();

                                                                                                                                   temp = planeObj->SearchFlight(planeObj->AirplaneRoot, PNo);

                                                                                                                                   planeObj->Update(temp->AirlineRoot, tk);

                                                                                                                                   break;

                                                                                                }

                                                                                                case 6:

                                                                                                {

                                                                                                                                  system("cls");

                                                                                                                                  planeObj->DispPlanes(planeObj->AirplaneRoot);

                                                                                                                                  break;

                                                                                                }

                                                                                                case 7:

                                                                                                {

                                                                                                                                  cout << "*******Whole planes*******" << endl;

                                                                                                                                  cout << "                    Plane No # 1                    " << endl;

                                                                                                                                  cout << "Company Name                PIA" << endl;

                                                                                                                                  cout << "Arrival time                3 AM" << endl;

                                                                                                                                  cout << "Departure time              6 PM" << endl;

                                                                                                                                  cout << "Destination                 Lahore" << endl;

                                                                                                                                  cout << "*******************" << endl;

                                                                                                                                  cout << "                    Plane No # 2                    " << endl;

                                                                                                                                  cout << "Company Name                PIA" << endl;

                                                                                                                                  cout << "Arrival time                10 PM" << endl;

                                                                                                                                  cout << "Departure time              12 AM" << endl;

                                                                                                                                  cout << "Destination                 Islamabad" << endl;

                                                                                                                                  cout << "*******************" << endl;

 

                                                                                                                                  cout << "                    Plane No # 3                    " << endl;

                                                                                                                                  cout << "Company Name                PIA" << endl;

                                                                                                                                  cout << "Arrival time                8 PM" << endl;

                                                                                                                                  cout << "Departure time              10 PM" << endl;

                                                                                                                                  cout << "Destination                 Karachi" << endl;

                                                                                                                                  cout << "*******************" << endl;

 

                                                                                                                                  cout << "                    Plane No # 4                    " << endl;

                                                                                                                                  cout << "Company Name                Jet2" << endl;

                                                                                                                                  cout << "Arrival time                10 PM" << endl;

                                                                                                                                  cout << "Departure time              12 AM" << endl;

                                                                                                                                  cout << "Destination                 UK(London)" << endl;

                                                                                                                                  cout << "*******************" << endl;

 

                                                                                                                                  cout << "                    Plane No # 5                    " << endl;

                                                                                                                                  cout << "Company Name                Emirates" << endl;

                                                                                                                                  cout << "Arrival time                9 AM" << endl;

                                                                                                                                  cout << "Departure time              12 PM" << endl;

                                                                                                                                  cout << "Destination                 UAE(Dubai)" << endl;

                                                                                                                                  cout << "*******************" << endl;

 

                                                                                                                                  cout << "                    Plane No # 6                    " << endl;

                                                                                                                                  cout << "Company Name                AirFrance" << endl;

                                                                                                                                  cout << "Arrival time                8 PM" << endl;

                                                                                                                                  cout << "Departure time              10 PM" << endl;

                                                                                                                                  cout << "Destination                 France(Paris)" << endl;

                                                                                                                                  cout << "*******************" << endl;

                                                                                                                                  getchar();

                                                                                                                                  getchar();

                                                                                                                                  break;

                                                                                                }

                                                                                                case 10:{

                                                                                                                                                cout << "Thank you so much" << endl;

                                                                                                                                                cout << "We will Miss you" << endl;

                                                                                                                                                getchar();

                                                                                                                                                getchar();

                                                                                                                                                option2 = 0;

                                                                                                                                                break;

                                                                                                }

                                                                                                default:{

                                                                                                                                                cout << "Sorry!! This option is not found" << endl;

                                                                                                                                                getchar();

                                                                                                                                                getchar();

                                                                                                                                                break;

                                                                                                }

 

                                                                                                }

                                                                                }

                                                                                }

                                                                }

                                                                }

                                                               

                                                                else

                                                                {

                                                                                if (c == 10)

                                                                                {

                                                                                                cout << "Now System is Blocked" << endl;

                                                                                                getchar();

                                                                                                getchar();

                                                                                }

                                                                                else

                                                                                {

                                                                                                cout << "Wrong password please Enter again" << endl;

                                                                                                cout << endl << "Sytem will block after 10 wrong tries" << endl;

                                                                                                getchar();

                                                                                                getchar();

                                                                                                c++;

                                                                                }

                                                                }

                                               

                                }

                }

                getchar();

                getchar();

                return 0;

}

Comments

  1. There is a free Unified Modeling Language (UML) editor called Violet that is a jar file that can be loaded into a GUI (windows, mac, or linux) with Java 1.6. You can export the Class Diagrams as PNGs or JPEGs.

    Have you considered wrapping the C++ plus code above in the PRE and CODE HTML tags?

    ReplyDelete
    Replies
    1. thank u so sir for helping me out.
      And sorry sir i did not wrap this code into pre tag but i should wrap it and i will use code tag to define it on html editor

      Delete
    2. Dia is a better choice. I just loaded a saved Object Diagram back into Violet. All the attributes are missing from the objects.

      Delete
    3. thank u so much to guide me brother
      i really need these kinds of opinions.

      Delete
    4. and i added a the pre tag now...

      Delete
    5. Great. Do you have a github link?

      Delete
    6. no sorry sir!!
      i don't have git hub link.

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. #include "Plane.h"
    #include "Airport.h"
    #include "Seats.h"
    #include "Passenger.h"
    .
    .
    .

    ReplyDelete

Post a Comment

Popular posts from this blog

Multiple inheritance,friend function and multiple file in oop(object oriented programming)

Concepts of OOP (object oriented programming)

Concepts in c++........