to develop airline ticket booking Program

Nov 15, 2008 at 5:21pm
Hi i am Pala n i am new here
i need to make a program on airline ticket booking.......
Well what i need is a code.

The airline company, has engaged your team to develop a
new Airline Ticket Reservation System. The new system should cater for the
use of mini airplane with the occupancy of 20 passengers. The seating
structure or seating plan of the airplane can be illustrated as below:

seat no

A B C D E
1 0 0 0 0 0
2 0 0 0 0 0
3 0 0 0 0 0
4 0 0 0 0 0

The diagram above shows how the seating in the airplane is represented by
using a two dimensional array with 4 rows (numbered 1 to 4) and 5 columns
(named A to E) Each seat number is being represented by the format [Row]
[Column], e.g. Seat No. 3B.
The new system should initialize all the seats (ie. the two dimensional array)
with the value Zero, which denotes that a seat is available. Before any seat
can be allocated to the user (ie. the customer), the system should check that


enough seats are available. If there are enough, the system will book the
seat(s) by assigning a Booking ID to the appropriate array element(s). Once
a seat is booked, the booking ticket will be displayed on the screen. One
customer can book more than 1 seat; thus a particular Booking ID may be
assigned to more than 1 seat.
The new system should also be able to provide a Seating Occupancy Plan
for review by the user whenever it is required. This plan enables the user to
view the availability of seats on the airplane.
The requirements are as follows:
1. The Booking ID is defined as integer type and with length of 3.
2. The Booking ID is being generated by the system automatically and
sequentially, e.g. 100, 101, 102 and so on.
3. The seats will be allocated in order, from the first row till the last row,
and, within each row, from the first seat number till the last seat number.
Users are not allowed to choose their seat numbers.


Gather all the information required and develop the necessary program by
using C language. The program should perform the following:
1) Display the Airline Reservation Menu for the user to select from
2 main options, which are to do Booking and Display Seat Layout &
Occupancy. There is one last option - to EXIT from the system after
displaying an appropriate farewell message.
2) Booking
- Ask user for the number of seats required
- Generate the Booking ID (if enough seats are available)
- For each seat required,
o ask for the passenger name,
o assign the Booking ID to the seat, and
o display the ticket in following format:
Note: - The Flight Information (Flight No., Date, Time and Gate) will be
initialized either during compile-time or run-time. The details
are to be stored in a Structure variable.
- Have all the necessary validation in place, including useful
messages, e.g. “Not enough seats available!”, “The flight is
fully booked!”, etc.
- You MUST use a Two Dimensional Array to store the seat
information (ie. the Booking ID or a Zero value).

3) Display Seat Layout & Occupancy
- A sample layout plan is as shown below:
A B C D E
1 101 101 101 102 102
2 102 103 103 104 105
3 0 0 0 0 0
4 0 0 0 0 0



PLZ PLZ PLZ PLZ PLZ PLZ help me i really need it.bcos i need to pass up this assignment on this friday. and thanks a lot for helping.
Nov 15, 2008 at 5:49pm
I don't think that many people here will do your homework for you, however if you start programming this and you tell us what you aren't able to develop, you will get many answers.

Just for starting your program, create a boolean array like this:
bool seats[4][5];
Nov 16, 2008 at 7:47am
this is the code do for myself ,but i cant store the date inside the array,can anyone help me to solve this problem

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#include <stdio.h>
#include <string.h>

struct flight_date {
	int day;
	int	month;
	int year;
};

struct flight_time {
	int hour;
	int minute;
};

struct flight_information {
	char flight_num[4];
	struct flight_date date;
	struct flight_time time;
	char gate[2];
}flight_info;


main()
{
	int seat[4][5] = {0};
	int i,j,choice,num_of_seat,empty_seat=0,row,col,x=4,y=5,z=0;
	int booking_id ;
	char name[20];

	strcpy(flight_info.flight_num, "AK65");
	strcpy(flight_info.gate, "G9");
	flight_info.date.day = 25;
	flight_info.date.month = 12;
	flight_info.date.year = 2008;
	flight_info.time.hour = 23;
	flight_info.time.minute = 45;

	printf("------Airline Reservation Menu------\n\n\n");
	printf("Press \"1\" -\tBooking\n");
	printf("Press \"2\" -\tDisplay Seat Layout & Occupancy\n");
	printf("Press \"3\" -\tExit\n");
	printf("\nEnter your choice > ");
	scanf("%d", &choice);
	printf("\n");

	
	
	switch (choice)
	{
	case 1:
		printf("Amount of seat : ");
		scanf("%d", &num_of_seat);

		for (i=0; i<4; i++)
		{
			for (j=0; j<5; j++)
			{
				if (seat[i][j] == 0)
					empty_seat += 1;
			}
		}
		if (num_of_seat > empty_seat)
		{
			printf("Not enough seats available!\n");
			break;
		}
		else
			booking_id = 101;

		fflush(stdin);
		printf("Please enter your name : ");
		scanf("%19[^\n]s", &name);
		
		for (i=0; i<4; i++)
		{
			for (j=0; j<5; j++)
			{
				switch(num_of_seat)
				{
					case 1:
					case 2:
					case 3:
					case 4:
					case 5:
						seat[i][num_of_seat-1] = booking_id;
						break;
					case 6:
						seat[i+1][num_of_seat-5] = booking_id;
						break;
				}
			}
		}

		printf("%d\t", seat[0][0]);
		printf("%d\t", seat[0][1]);
		printf("%d\t", seat[0][2]);
		printf("%d\t", seat[0][3]);
		printf("%d\t\n", seat[0][4]);

		printf("%d\t", seat[1][0]);
		printf("%d\t", seat[1][1]);
		printf("%d\t", seat[1][2]);
		printf("%d\t", seat[1][3]);
		printf("%d\t\n", seat[1][4]);
		printf("%d\n", booking_id);
	break;
	case 2:
		seat[2][0] = 101;
		printf("\tA\tB\tC\tD\tE\n");
		for (row=0; row<4; row++)
		{
			printf("\n%d", row+1);
			for (col=0; col<5; col++)
			{
				printf("\t%d", seat[row][col]);
			}
		}
		break;
	case 3:
		printf("Bye bye !\nHave A Nice Day !");
		break;
	default:
		printf("Unknown choice , please read the instructions again !");
	}

	printf("\n\n");
}
 
Last edited on Nov 16, 2008 at 7:48am
Nov 16, 2008 at 11:25am
You can store data in an array with a command like this:
myArray[i][j]=value

I see that you did something relevant.Can you make it more clear,to take a better answer?
Topic archived. No new replies allowed.