c i did some of it :
Code:
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
void mainmenu(void);
void menu_PurchaseTicket(void);
void menu_chooseTicket(void);
void menu_BizClass(void);
void menu_EconomyClass(void);
void menu_DepartureBizKL(void);
void menu_DepartureBizLK(void);
void menu_DepartureEconKL(void);
void menu_DepartureEconLK(void);
void menu_ViewSeating(void);
void menu_ChooseDestination(void);
void menu_ChooseTime(void);
void menu_ChooseSeat(void);
int exit_ViewSeating, cust_TicketClass, cust_Destination, cust_Time, cust_Seat;
char MenuSelect,TicketSelect,BizClassSelect,EconomyClassSelect,ViewSeatingSelect;
main()
{
mainmenu();
}
void mainmenu()
{
printf("\n\t\t\t\t--WELCOME TO--");
printf("\n\t\t<<<< AIRLINE RESERVATION SYSTEM >>>> \n");
printf("\n\n\t\t\t\t%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
printf("\n\t\t\t\t%%%%%% Main Menu %%%%%%%\n");
printf("\t\t\t\t%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n");
printf("\n\t\t\t\tP to Purchase Ticket\n");
printf("\n\t\t\t\tV to View Seating Arrangement\n");
printf("\n\t\t\t\tQ to Quit the system\n\n");
printf("\n\n\t\t\t\tPlease enter your choice:");
fflush(stdin);
MenuSelect = getchar();
switch(MenuSelect)
{
case 'P':
case 'p':
menu_PurchaseTicket();
break;
case 'V':
case 'v':
menu_ViewSeating();
break;
case 'Q':
case 'q':
printf("Thank you for choosing Airlines Reservation System");
break;
default:
printf("Please enter the correct selection");
}
}
void menu_PurchaseTicket()
{
menu_chooseTicket();
menu_ChooseDestination();
menu_ChooseTime();
menu_ViewSeating();
menu_ChooseSeat();
int seat[cust_TicketClass][cust_Destination][cust_Time][cust_Seat];
int a,b,c,d;
for(a=0;a<2;a++)
{
if(cust_TicketClass == 0)
printf("Business Class");
else
printf("Economy Class");
for(b=0;b<2;b++)
{
if(cust_Destination == 0)
printf("Destination: Kuala Lumpur --> Langkawi\n\n");
else
printf("Destination: Langkawi --> Kuala Lumpur\n\n");
for(c=0;c<5;c++)
{
switch(cust_Time)
{
case '1':
printf("Departure Time: 9.00 a.m\n");
case '2':
printf("Departure Time: 11.00 a.m\n");
case '3':
printf("Departure Time: 1.00 p.m\n");
case '4':
printf("Departure Time: 3.00 p.m\n");
case '5':
printf("Departure Time: 5.00 p.m\n");
default:
printf("Please enter the correct selection\n\n");
for(d=0;d<25;d++)
{
if(cust_Seat>25 || cust_Seat<0)
printf("Invalid Seat Number");
if(cust_Seat>0 || cust_Seat<25)
seat[cust_TicketClass][cust_Destination][cust_Time][cust_Seat]=1;
}
}
}
}
}
}
void menu_chooseTicket()
{
printf("Please choose your Tciket Class\n\n");
printf("1 >> Business Class\n\n");
printf("2 >> Economy Class\n\n");
printf("Please enter your selection --> ");
fflush(stdin);
scanf("%d",&cust_TicketClass);
}
void menu_ChooseDestination()
{
printf("Please choose destination\n\n");
printf("1 >> Kuala Lumpur --> Langkawi\n\n");
printf("2 >> Langkawi --> Kuala Lumpur\n\n");
printf("Please enter your selection --> ");
fflush(stdin);
scanf("%d",&cust_Destination);
}
void menu_ChooseTime()
{
printf("Please choose flight time\n\n");
printf("1 >> 9 a.m.\n\n");
printf("2 >> 11 a.m.\n\n");
printf("3 >> 1 p.m.\n\n");
printf("4 >> 3 p.m.\n\n");
printf("5 >> 5 p.m.\n\n");
printf("Please enter your selection --> ");
fflush(stdin);
scanf("%d",&cust_Time);
}
void menu_ChooseSeat()
{
printf("Please choose your seat --> ");
scanf("%d",&cust_Seat);
}
void menu_BizClass()
{
printf("Destination Menu\n");
printf("A --> Kuala Lumpur to Langkawi\n");
printf("B --> Langkawi to Kuala Lumpur\n");
printf("M --> Return to Main Menu\n");
printf("Please Enter your Selection -->");
fflush(stdin);
BizClassSelect = getchar();
switch(BizClassSelect)
{
case 'a':
case 'A':
menu_DepartureBizKL();
break;
case 'b':
case 'B':
menu_DepartureBizLK();
break;
case 'M':
case 'm':
mainmenu();
break;
default:
printf("Please enter the correct selection");
menu_BizClass();
}
}
void menu_EconomyClass()
{
printf("Destination Menu\n");
printf("A --> Kuala Lumpur to Langkawi\n");
printf("B --> Langkawi to Kuala Lumpur\n");
printf("M --> Return to Main Menu\n");
printf("Please Enter your Selection -->");
fflush(stdin);
EconomyClassSelect = getchar();
switch(EconomyClassSelect)
{
case 'a':
case 'A':
menu_DepartureEconKL();
break;
case 'b':
case 'B':
menu_DepartureEconLK();
break;
case 'M':
case 'm':
mainmenu();
break;
default:
printf("Please enter the correct selection");
menu_EconomyClass();
}
}
void menu_DepartureBizKL()
{
printf("Business Class\n");
printf("Departure Menu\n");
printf("Destination: Kuala Lumpur --> Langkawi\n");
printf("A --> 9.00 a.m\n");
printf("B --> 11.00 a.m\n");
printf("C --> 1.00 p.m\n");
printf("D --> 3.00 p.m\n");
printf("E --> 5.00 p.m\n");
printf("Please enter your selection --> ");
}
void menu_DepartureBizLK()
{
printf("Business Class\n");
printf("Departure Menu\n");
printf("Destination: Langkawi --> Kuala Lumpur\n");
printf("A --> 9.00 a.m\n");
printf("B --> 11.00 a.m\n");
printf("C --> 1.00 p.m\n");
printf("D --> 3.00 p.m\n");
printf("E --> 5.00 p.m\n");
printf("Please enter your selection --> ");
}
void menu_DepartureEconKL()
{
printf("Economy Class\n");
printf("Departure Menu\n");
printf("Destination: Kuala Lumpur --> Langkawi\n");
printf("A --> 9.00 a.m\n");
printf("B --> 11.00 a.m\n");
printf("C --> 1.00 p.m\n");
printf("D --> 3.00 p.m\n");
printf("E --> 5.00 p.m\n");
printf("Please enter your selection --> ");
}
void menu_DepartureEconLK()
{
printf("Economy Class\n");
printf("Departure Menu\n");
printf("Destination: Langkawi --> Kuala Lumpur\n");
printf("A --> 9.00 a.m\n");
printf("B --> 11.00 a.m\n");
printf("C --> 1.00 p.m\n");
printf("D --> 3.00 p.m\n");
printf("E --> 5.00 p.m\n");
printf("Please enter your selection --> ");
}
void menu_ViewSeating()
{
int row,col;
int seats[5][5]={0};
printf("\t\tSeating In All Flights\n\n");
printf("\t1\t2\t3\t4\t5\n");
for (row=0; row<5; row++)
{
printf("\n%d", row+1);
for (col=0; col<5; col++)
{
printf("\t%d", seats[row][col]);
}
}
printf("\n\nBusiness Class Seats: 11,12,13,14,15\n\n");
printf("\n\nEconomy Class Seats: Other than the above\n\n");
}
and here wat we should do :
)to book
2)to cancel
3)view data
4)quit
so when the user press 1 it should go for booking when it go for booking the it should allow the user to choose destination from four destination and the charge of every destination should be written then they should choose if it is one way or 2 ways then choose the day time and then choose how many passenger and how many of them are adult children infant then allow them to enter them name age passport number and then display the charge for the tickets if there is any adult then 100% of the charge children 60% and infant 10%.but if the user entered 2 then it should go for cancellation so the user after he enter his passport number should be allowed to cancel his booking with a full charge back but if the cancellation were at the same time then only 60% of the charge and for view data after the user enter his passport number they should display the whole data of the booking. i have no idea how to do this and the teacher didnt tell us how to do it he want us to read and learn so plz ireally need ur help