1. Introduction
The objective of this project is to develop an Airline Reservation System.
Green Dot airline has just purchased a computer for its new automated reservation
system. You have been asked to program the new system. You are to write a program to
assign seats on each flight of the airline’s only plane. Assume the plane has 6 rows with 3
seats in each row.
When your program starts, a system menu will be displayed:
GREEN AIRLINE ON-LINE RESERVATION SYSTEM
(A) Reserve a seat
(B) Cancel a reservation
(C) Display Seating arrangement
(D) View Waiting List
(E) Transaction Report
(F) Quit
>> Enter Choice : XX
- Reserve a Seat adds a person to a flight or waiting list
- Cancel a Reservation removes a passenger from a flight or waiting list
- Display Seating arrangement displays the seats occupation and the customer ID
occupying it.
- View waiting list allows viewing of customer IDs who are placed on waiting list
- Transaction Report allows generation of a report containing all transactions taken
place
2. Functional Requirements
2.1 Reserve a seat
When a customer wants to reserve a seat, you should do following:
a) Input a passenger ID
b) Check if any seats are available. If yes, allocate a seat.
c) If seats are not available, check if the customer wants to be put in the waiting list.
If yes, assign the passenger ID to waiting list.
MINI-PROJECT A
Course: Diploma in Engineering Informatics
Module: IT1733 – Principles of Computing

Page 2 of 3
d) Enter time and date of transaction.
For each transaction, a log is generated. The log data will comprise of the following:
Field Description Format
Transaction Code A code to identify type of
transaction
1 - Assign seat
2 – Put on waiting List
3 – Remove from waiting List
4 - Cancel reserved seat
5- Cancel from waiting List
Passenger ID A unique ID which
identifies the passenger
1-9999
Time Time of transaction HHMM
Date Date of transaction DDMMYY
A maximum of 100 transactions can be stored.
2.2 Cancel a reservation
When a customer wants to cancel a reservation, the program will display the
following.:
Cancel Reservation
(A) Cancel Reserved seat
(B) Cancel queue in waiting list
(C) Return to previous screen
>> Enter Choice : XX
a) Request for the passenger’s ID
b) Search for the passenger’s ID and delete it.
c) For (A), if the waiting list is empty, update the seating array so that the seat is
available for the other bookings
d) For (A), if the waiting list is not empty, get the first person in the waiting list who
opted for the same seating category, and allocate the seat to them. The system
can accommodate of maximum of 10 waiting lists.
2.3 Display Seat arrangement
Create your own output screen design to show the seating arrangement.
Seat1 Seat2 Seat3
Row 1: [1223] [3232] []
Row 2: [1211] [1121] []
Row 3: [] [] []
Row 4: [] [3411] []
Row 5: [] [] []
Row 6: [] [] []


Page 3 of 3
2.4 Display the waiting list
Design your output to show the waiting list. The following is an example:
Waiting List [3]:
=====================
1. 1231 140203
2. 1341 140203
3. 2313 150203
2
.5 Transaction Report
A transaction report will be generated when this option is selected. The following will be
displayed: the transaction code, passenger ID, and date and time of transaction. For
example :
Transaction Report
Transaction Code Passenger ID Time Date
1 1223 1130 140203
2 1231 1230 140203
………..

3. Hints
-Array declaration
To keep records of your data, you will need to declare the following 1 Dimensional arrays
to store the following information : passenger ID , waiting list ID, and transaction
information to capture the transaction code, passenger ID, date and time of transaction.
-Modular Program Design
Your program should be designed in a modular manner, using a Structure Chart. As a
guideline, each module that you develop should not comprise more than 30 lines of
pseudo code.
-Decision Making
You are free to make use of If/else, switch/case, while loops, arithmetic, relational and
logical operators in implementing decision making.

We're not going to do it for you. What have you done so far?

#include <iostream>
#include <string>
using namespace std;

void reservation();
void cancelseat();
void Displayseat();
void view_cus_ID();
void transac_report();
void quit();

	int passengerid;
	int maxpassenger[18];
	int seatx[6][3];
	int count=0;
	int transid[10];



int main(void)
{
	int choice;
	
	do
	{


	cout<<"GREEN AIRLINE ON-LINE RESERVATION SYSTEM"<<endl;
	cout<<"==============================================================="<<endl;

	cout<<"Please select one of the following choice and proceed according"<<endl;
	cout<<"(1)	Reserve a seat "<<endl;
	cout<<"(2)	Cancel a reservation "<<endl;
	cout<<"(3)	Display Seating arrangement "<<endl;
	cout<<"(4)	View Waiting List "<<endl;
	cout<<"(5)	Transaction Report "<<endl;
	cout<<"(6)	quit "<<endl;
	cout<<"==============================================================="<<endl;
	cout<<"Enter choice: ";
	cin>>choice;
	system("cls");
	switch(choice)
	{
	case 1 :reservation();
		break;
	case 2 :cancelseat();
		break;
	case 3 :Displayseat();
		break;
	case 4 :view_cus_ID();
		break;
	case 5 :transac_report();
		break;
	case 6 :quit();
		break;
	default: cout <<" Invalid choice entered!"<<endl;
	}

	}
	while(choice !=6);

	return 0;
	
}
	
	void reservation()
	{
		int rowch, seatch;
		int counter = 0;
		int row,seat;
		
		cout <<"Please Enter Passenger ID 0000 - 9999: "<<endl;
		cin>>passengerid;

		cout<<"\t"<<"Seat1"<<"\t"<<"Seat2"<<"\t"<<"Seat3"<<endl;
		cout<<"Row1"<<"\n"<<"\n"<<"\n"<<"Row2"<<"\n"<<"\n"<<"\n"<<"Row3"<<"\n"<<"\n"<<"\n"<<"Row4"<<"\n"<<"\n"<<"\n"<<"Row5"<<"\n"<<"\n"<<"\n"<<"Row6"<<endl;
	/*	for(seat= 0; seat<=6; seat++)
		{
			
			
			
			for(row = 0; row <=3; row++)
			{
				if(seatx[seat][row] == 0)
				{
				
					cout << seat+1<<"\t" << row+1<<endl;
				
					counter++;
				}
				
			}
		}
			if(counter==0)
			{
				cout<<"Do you wanna be in waiting list?";


			}
			
			else
			{
			cout<< "Assign seat(row col):"<<endl;
			cout << "Seat: " << endl;
			cin>>seatch;
			cout << "Row: " << endl;
			cin >> rowch;
			cout<< "Seat selected is :" <<"Seat :"<<seatch<<"Row :"<<rowch<<endl; 
			seatx[rowch-1][seatch-1] = 1;
			system("pause");
			system("cls");
			}*/

			return;
		}

	   
	void cancelseat()
	{
		int choice;
		string waiting[18];
		int waitinglist=0;
	cout << "Cancel Reservation" << endl;
	cout << "(1) Cancel Reserved Seat" << endl;
	cout << "(2) Cancel Queue In Waiting List" << endl;
	cout << "(3) Return To Previous Screen" << endl;
	cout << ">> Enter Choice: ";
	cin >> choice;
	
	if ( choice == 1 )
	
	{	cout << "Enter Passenger ID: " << endl;
		cin >> passengerid;
		count--;
		cout << "Your Reservation Has Been Cancelled.Thank You And We Hope To See You Again."<< endl;
	}
	else if ( choice == 2 )
	 	
	{	cout << "Enter Passenger ID: " << endl;
		cin >> passengerid;
		waitinglist--;
		cout << "Your Waiting List Has Been Cancelled.Thank You And We Hope To See You Again." << endl;
	}
	else if ( choice == 3 )
		{return;
		}
	return;
	}

void Displayseat()
	{
		cout<<"Not done"<<endl;
		return;
	}
	
void view_cus_ID()
	{
		cout<<"Not done"<<endl;
		return;
	}
	
void transac_report()
	{
		cout<<"Not done"<<endl;
		return;
	}
	

void quit()
	{
		cout<<"thank you" <<endl;
		return;
	}

<< moderator edit: added code tags: [code][/code] >>

that what i had done so far...and the dateline to submit this program is due soon...i seriously need help...

by the way is the program differcult for me?I studied C++ less then a year.

>that what i had done so far
Okay, now would you be kind enough to tell us what it doesn't do correctly so that we can better help you?

>by the way is the program differcult for me?I studied C++ less then a year.
Everyone learns differently, but no, I wouldn't see this as too difficult for you unless by less than a year you mean a week or two.

i wan to fit the word empty/taken in my program...now it look like this...

[IMG]http://img.photobucket.com/albums/v737/Voiceoflove/c1.jpg[/IMG]

and the user can select where they want to be seated and
after choseing the empty sits...the next user will not be able to
select the same seat because the seat is show "taken".


i want my program to look like this...

seat 1 seat 2 seat 3
row 1 empty taken taken

row 2 empty empty empty

row 3 taken taken taken

as the above is my reservation function.

void reservation()
	{
		int rowch, seatch;
		int counter = 0;
		int row,seat;
		
		cout <<"Please Enter Passenger ID 0000 - 9999: "<<endl;
		cin>>passengerid;

		cout<<"\t"<<"Seat1"<<"\t"<<"Seat2"<<"\t"<<"Seat3"<<endl;
		cout<<"Row1"<<"\n"<<"\n"<<"\n"<<"Row2"<<"\n"<<"\n"<<"\n"<<"Row3"<<"\n"<<"\n"<<"\n"<<"Row4"<<"\n"<<"\n"<<"\n"<<"Row5"<<"\n"<<"\n"<<"\n"<<"Row6"<<endl;
		for(seat= 0; seat<=6; seat++)
		{
			
			
			
			for(row = 0; row <=3; row++)
			{
				if(seatx[seat][row] == 0)
				{
				
					cout << seat+1<<"\t" << row+1<<endl;
				
					counter++;
				}
				
			}
		}
			if(counter==0)
			{
				cout<<"Do you wanna be in waiting list?";


			}
			
			else
			{
			cout<< "Assign seat(row col):"<<endl;
			cout << "Seat: " << endl;
			cin>>seatch;
			cout << "Row: " << endl;
			cin >> rowch;
			cout<< "Seat selected is :" <<"Seat :"<<seatch<<"Row :"<<rowch<<endl; 
			seatx[rowch-1][seatch-1] = 1;
			system("pause");
			system("cls");
			}

			return;
		}

<< moderator edit: added [code][/code] tags >>

From what I gather, you use a two dimensional array of int (seatx) to represent the rows and columns of seats and the value of 1 to represent empty and 0 to represent taken. To display empty or taken instead of 0 or 1 when displaying seat availability you could use an if/else statement within a nested loop to check for current value of each seat and if it is 1 then output empty and if zero then output taken.

If there were a significant numbr of possible values to consider then a switch statement may be a better choice than an extended if/else if/else statement, but with just the two choices, an if/else statement seems reasonable.

Is it just me, or is this exercise given REALLY, REALLY, REALLY frequently?

It might be a good idea to just make a sticky of a bunch of general tips and code snippets, such as for the visual setup...

You 're right.
I met this question on other forum like about 20 times.
Better create a separate snippet for this program!!!

From what I gather, you use a two dimensional array of int (seatx) to represent the rows and columns of seats and the value of 1 to represent empty and 0 to represent taken. To display empty or taken instead of 0 or 1 when displaying seat availability you could use an if/else statement within a nested loop to check for current value of each seat and if it is 1 then output empty and if zero then output taken.

If there were a significant numbr of possible values to consider then a switch statement may be a better choice than an extended if/else if/else statement, but with just the two choices, an if/else statement seems reasonable.

is this possible to do it with a nested for loop using 0 and 1 to represent empty and taken?...i nid some example to do it...

You can access any given seat to see if it is taken by just indicating the desired indices. The easiest way to deal with looping through all the seats to display availability is the nested loop approach as long as you have seatx a multidimensioanal array.

//using rough outlines

//to check a given seat using user input row and column 
if seatx[row - 1][column - 1] equals 0
  output something
else
  output something else

//display availability of all seats, not just one
for all row indices
  for all column indices
     if seatx[row index][column index] equals 0
        output something
     else
        output something else
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.