+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 10 of 12

Thread: help me urgent

  1. #1
    Newbie dky8810 is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    9

    help me urgent

    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

  2. #2
    Super Moderator WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther's Avatar
    Join Date
    Jul 2006
    Age
    36
    Posts
    11,680
    Blog Entries
    57

    Re: help me urgent

    What do you have so far? We won't do your homework for you, but we can help guide you to the solution.
    CodeCall Blog | CodeCall Wiki | Shareware
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  3. #3
    Newbie dky8810 is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    9

    Re: help me urgent

    Quote Originally Posted by WingedPanther View Post
    What do you have so far? We won't do your homework for you, but we can help guide you to the solution.
    Code:
    #include<stdio.h>
    #include<string.h>
    #include<stdlib.h>
    #define sizeR 4
    #define sizeC 5
    
    void menu(void);
    void Booking(void);
    void getinf(void);
    void Display(void);
    
    typedef struct{
    	int id;
    	char flightNo[40];
    	char date[20];
    	char time;
    	char gate;
    	char seatNo;
    }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");
    		break;
    		
    		
    	}
    }
    
    void main()
    {
    
    	menu();
    
    
    }
    
    void Booking(void)
    {
    	customer cust[sizeR][sizeC];
    	int i;
    	int j;
    	int row;
    	int col;
    	printf("How many seat are you required:\n");
    	scanf("%d",&i);
    	for(row=0;row<sizeR;row++){
    		for(col=0;col<sizeC;col++){
    			if(cust[sizeR][sizeC] != 0){
    	int fp[4]={0},i,f;
    
    	printf("hhh\n\n");
    
    	for(i=0;i<10;i++){
    		f=cust[sizeR][sizeC];
    		fp[f]++;
    	}
    	for(i=0;i<4;i++){
    		printf("%d\n\n",i,fp[i]);
    	}
    
    
    				
    
    
    
    
    
    			}
    		}
    	}
    
    			
    				
    			else
    				printf("Not enough seats available!The flight is fully booked!");
    }
    void Display(void)
    {
    }
    void getinf(void)
    {
    /*	int i;
    
    	printf("Please enter your name:");
    	scanf("%[^\n]",cust[sizeR][sizeL].name);*/
    }
    Last edited by dky8810; 11-15-2008 at 04:28 PM. Reason: add code tags (the # button)

  4. #4
    Super Moderator WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther's Avatar
    Join Date
    Jul 2006
    Age
    36
    Posts
    11,680
    Blog Entries
    57

    Re: help me urgent

    OK, now, what questions do you have to move forward? I notice that you have nothing in your display function, and your menu only lets you pick once.
    CodeCall Blog | CodeCall Wiki | Shareware
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  5. #5
    Newbie dky8810 is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    9

    Re: help me urgent

    Quote Originally Posted by WingedPanther View Post
    OK, now, what questions do you have to move forward? I notice that you have nothing in your display function, and your menu only lets you pick once.
    if(cust[sizeR][sizeC] != 0)
    the problem in this line show by my compile is binary '!=':'customer'does not define this operate or a conversion to a type acceptable to the predefined operator).
    cust[sizeR][sizeC]is array of structure.
    what code i need to use for know how many array element is empty ??
    line 60-70
    Last edited by dky8810; 11-15-2008 at 04:28 PM.

  6. #6
    Newbie dky8810 is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    9

    Re: help me urgent

    i hv change the code :
    Code:
    void Booking(void)
    {
    int ID[4][5]={
    {0,0,0,0,0},
    {0,0,0,0,0},
    {0,0,0,0,0},
    {0,0,0,0,0}
    };
    
    
    customer cust[sizeR][sizeC];
    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[4][5]){
    flag=1;
    break;
    }
    }
    
    if(flag==0)
    printf("Please enter your name\n",cust[sizeR][sizeC].name);
    else
    printf("Not enough seats available!The flight is fully booked!");
    }
    }
    in this part it keep looping how to stop it??
    if(flag==0)
    printf("Please enter your name\n",cust[sizeR][sizeC].name);
    Last edited by WingedPanther; 11-15-2008 at 07:33 PM. Reason: add code tags (the # button)

  7. #7
    Super Moderator WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther's Avatar
    Join Date
    Jul 2006
    Age
    36
    Posts
    11,680
    Blog Entries
    57

    Re: help me urgent

    1) please use code tags when posting code.
    2) you cannot compare a struct with 0. You have to compare an item in the struct with 0.
    3) the break only breaks you out of the inner for loop, not the outer for loop.
    CodeCall Blog | CodeCall Wiki | Shareware
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  8. #8
    Newbie dky8810 is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    9
    Quote Originally Posted by WingedPanther View Post
    1) please use code tags when posting code.
    2) you cannot compare a struct with 0. You have to compare an item in the struct with 0.
    3) the break only breaks you out of the inner for loop, not the outer for loop.
    Code:
    int ID[4][5]={
    {0,0,0,0,0},
    {0,0,0,0,0},
    {0,0,0,0,0},
    {0,0,0,0,0}
    };
    this is "array" not struct ,so i dont understand why saying that compere a struct with 0?
    the break .....can give an exemple?

    Quote Originally Posted by dky8810 View Post
    Code:
    int ID[4][5]={
    {0,0,0,0,0},
    {0,0,0,0,0},
    {0,0,0,0,0},
    {0,0,0,0,0}
    };
    this is "array" not struct ,so i dont understand why saying that compere a struct with 0?
    the break .....can give an exemple?
    help help!!
    i no ideal for next part

    question:
    now is this part make me blur:what i need to write in <if>the code that can let me check still got how many empty place in my cust array??
    Code:
    Code:
    for(row=0;row<sizeR;row++){
    for(col=0;col<sizeC;col++){
    if(0==ID[row][col]){
    	for(j=0;j<i;j++){
    		printf("Enter your name");
    		scanf("%[\n]c",cust[sizeR][sizeC].name);
    
    }
    else{
    printf("Not enough seats available!The flight is fully booked!");
    can?
    Last edited by WingedPanther; 11-17-2008 at 11:03 AM. Reason: triple post

  9. #9
    Super Moderator WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther's Avatar
    Join Date
    Jul 2006
    Age
    36
    Posts
    11,680
    Blog Entries
    57

    Re: help me urgent

    1) You are never updating array ID to non-zero values.
    2) It seems like you need to sit down and create a flowchart/pseudocode of your logic. I don't have a clear sense that you have thought out what you want to do. Instead, you seem to be changing things and getting things worse, rather than better.
    CodeCall Blog | CodeCall Wiki | Shareware
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  10. #10
    Newbie dky8810 is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    9

    Re: help me urgent

    Code:
    void Booking(void)
    {
     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 con;
     int id;
     int i;
     int j;
     int row;
     int col;
     int flag=0;
     printf("How many seat are you required:\n");
     scanf("%d",&i);
     int available_seats = 0;
      for(row=0; row<sizeR; row++){
       for(col=0; col<sizeC; col++){
        if(cust[sizeR][sizeC].id == 0){
         available_seats++;
        }
       }
      }
      if(available_seats >= i){
       for(j=0;j<i;j++){
        printf("\t\t\t--- KL Airline Booking Ticket ---\n");
        cust[sizeR][sizeC].id=id;
        id++;
        printf("\t\t\tBooking ID\t:%d",&cust[sizeR][sizeC].id);
        printf("\t\t\tFlight No.:");
        scanf("%s",cust[sizeR][sizeC].flightNo);
        fflush(stdin);
        printf("\t\t\tPassenger:");
        scanf("%[\n]s",cust[sizeR][sizeC].name);
        fflush(stdin);
        printf("\t\t\tDate:");
        scanf("%s",cust[sizeR][sizeC].date);
        fflush(stdin);
        printf("\t\t\tTime:");
        scanf("%s",cust[sizeR][sizeC].time);
        fflush(stdin);
        printf("\t\t\tGate:");
        scanf("%s",cust[sizeR][sizeC].gate);
        fflush(stdin);
    
        printf("\t\t\tSeat No:");
        scanf("%c",&cust[sizeR][sizeC].seatNo);
        fflush(stdin);
        i++;
        system("pause");
        system("cls");
               
    
        /* printf("Want Countinue? press 1");
        scanf("%d",&con);
        if(con==1)
        {
         system("cls");
         Booking();
        }
        else
        {
         system("cls");
         menu();
        }*/
       }
      }
    
    
    
          
      else{
       printf("Not enough seats available!");
      }
    why it keep looping?which line i wrong????
    Last edited by WingedPanther; 11-17-2008 at 04:12 PM. Reason: fix formatting to be readable

+ Reply to Thread
Page 1 of 2
1 2 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Urgent help
    By ahmed in forum C and C++
    Replies: 2
    Last Post: 11-08-2008, 01:01 AM
  2. urgent help please
    By radio86 in forum PHP Forum
    Replies: 0
    Last Post: 10-04-2008, 07:09 PM
  3. Urgent Help on Currency Converter!
    By tanxp002 in forum Java Help
    Replies: 3
    Last Post: 12-25-2007, 07:49 AM
  4. Urgent Help on Currency Converter!
    By tanxp002 in forum MarketPlace
    Replies: 3
    Last Post: 12-24-2007, 08:52 PM
  5. URGENT !!! I need help !!!
    By icycold89 in forum Java Help
    Replies: 16
    Last Post: 01-29-2007, 05:20 AM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts