help help urgent

Discussion in 'Computers' started by dky8810, Nov 16, 2008.

  1. dky8810

    dky8810 New Member

    question:
    The airline company, KL AIRLINE, has engaged your teanm to develop a new Airline Ticket Reservation System....airplane wiyh the occupancy of "20 passengers".

    !.display the KL "Airline Reservation Menu" for the user to select from 2 main options which are to do "Booking" and "display seat layout & occupancy".thr is one last option -to "exit" from the system after displaying an appropriate farewell message.

    2.Booking
    -ask user for yhe number of seat required
    -Generete the Booking ID(if enough seats are available)
    -for each seat required,
    *ask for the passenger name,
    *assign the booking ID to the seat, and
    *display the ticket in following format:
    -------------------------------------------------------------------------------------
    | --KL airline booking tikcket---- |
    | booking ID:100 Flight No.:AK65 |
    | Passenger:XXXXXXXXX Date :25-12-2008 |
    | Time :23:45 |
    | Gate :G9 |
    | seat No :3B |
    ---------------------------------------------------------------------------------------

    note:( Flight No,Date,Time,Gate )will be initizalized either during compile-time or run time.the details are to be stored in a "Struture variable"
    -hv all the necessary "validation" in place, including useful messages, "not enough seat available"
    - must use a Two Dimensional Array to store the seat information(the booking ID or a Zero value).

    3.display seat layout & Occupancy
    sample:
    A B C D E
    |--------------------------------------------|
    1 |101 | 101 | 101 |102 | 103 |
    |-------------------------------------------|
    2 |103 |104 |104 |104 |0 |
    |-------------------------------------------|
    | Aisle |
    |-------------------------------------------|
    3 | 0 | 0 | 0 | 0 | 0 |
    |-------------------------------------------|
    4 | 0 | 0 | 0 | 0 |0 |
    |-------------------------------------------|



    ******required to use :array,structure,Function***********
    T.T pls help hv to submit:19 nov 2008
    Code:
    #include<stdio.h>
    #include<string.h>
    #include<stdlib.h>
    #define sizeR 4
    #define sizeC 5
    
    void menu(void);
    void Booking(void);
    void Display(void);
    
    typedef struct{
    	int id;
    	char name;
    	char flightNo[6];
    	char date[10];
    	char time[3];
    	char gate[1];
    	char seatNo[1];
    }customer;
    customer cust[sizeR][sizeC];
    
    void menu(void)
    {
    	int choice;
    
    	printf("\t\t********TARC Airlene Reservation Menu*********\n");
    	printf("\t\t1) Booking\n");
    	printf("\t\t2) Seat Layout & Occupancy\n");
    	printf("\t\t3) Exit\n");
    
    	printf("\t\t\tYour choice : ");
    	scanf("%d",&choice);
    
    	switch(choice){
    	case 1:
    		Booking();
    		break;
    		
    	case 2:
    		Display();
    		break;
    	default:
    		printf("End the program\n");
    		break;
    		
    		
    	}
    }
    
    void main()
    {
    
    	menu();
    
    
    }
    
    void Booking(void)
    {
    	cust[sizeR][sizeC].id=100;
    	strcpy(cust[sizeR][sizeC].flightNo,"AK65");
    	strcpy(cust[sizeR][sizeC].date,"25-12-2008");
    	strcpy(cust[sizeR][sizeC].time,"23:45");
    	strcpy(cust[sizeR][sizeC].gate,"G9");
    	int ID[4][5]={
    	{0,0,0,0,0},
    	{0,0,0,0,0},
    	{0,0,0,0,0},
    	{0,0,0,0,0}
    	};
    	
    	int i;
    	int row;
    	int col;
    	int flag=0;
    	printf("How many seat are you required:\n");
    	scanf("%d",&i);
    	for(row=0;row<sizeR;row++){
    		for(col=0;col<sizeC;col++){
    			if(0==ID[row][col]){
    				flag=1;
    				break;
    			
    	
    
    		if(flag==0)
    		/*	for(i=0;i<cust[sizeR][sizeC];i++){*/
    			printf("Please enter your name\n");
    
    		/*	}*/
    		else
    			printf("Not enough seats available!The flight is fully booked!");
    
    	}
    	}
    	}
    }
    
    			
    			
    void Display(void)
    {
    	printf("\t\t   A\t   B\t   C\t   D\t   E\n");
    	printf("\t\t_________________________________________\n");
    	printf("\t1\t|\t\t\t\t\t|\n");
    	printf("\t\t_________________________________________\n");
    	printf("\t2\t|\t\t\t\t\t|\n");
    	printf("\t\t_________________________________________\n");
    	printf("\t\t|\t\tAisle\t\t\t|\n");
    	printf("\t\t_________________________________________\n");
    	printf("\t3\t|\t\t\t\t\t|\n");
    	printf("\t\t_________________________________________\n");
    	printf("\t4\t|\t\t\t\t\t|\n");
    	printf("\t\t_________________________________________\n");
    
    
    }
    
    
    pls help me correct it!!
    help !!pls
     

Share This Page