|
|||||||||
|
|
|||||||||
|
Advanced Computer Discussion Talk about more advanced computer related subjects in here. i.e. programming, networking, OS configurations, etc. |
|
||||||
![]() |
|
|
#1
|
||
|
||
|
help me urgent
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 ------ Quote:
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!! urgent ------ Quote:
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!! urgent ------ 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 and get customer name?? 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!"); ------ 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!");
}
which line i wrong? Last edited by dky8810; 11-17-2008 at 02:14 PM.. Reason: Automerged Doublepost |
| Join GeneralForum.com Today! |
Join GeneralForum.com today for FREE!GeneralForum.com is the fastest growing general forum on the web!
» Click here to join the fun! |
|
#2
|
|||
|
|||
|
I'm pretty sure nobody here knows how to help you with this.
I sure don't. And even if I did, no offense but that's a huge amount of work to expect to get help with for free. That and the fact that your formatting is terrible. It would take 20 minutes just to format that into something readable. |
|
#3
|
|||
|
|||
|
For sure Hybrix, how about you do YOUR work that YOU get paid for or find somebody credible to pay to help or do it for you...
|
|
#4
|
|||
|
|||
|
Took me a little while but I finally got it. I agree with Hybrix, your coding was screwed and took some serious effort to figure out. Next time you want some help at least make it easier on the individual.
KL Airline Reservation System solved via Icegoat Just dont forget to give credit where credit is due. |
|
#5
|
||
|
||
|
why
why got so many noob at this forum???i mean supernoob haha!!! |
|
#6
|
|||
|
|
|||
|
How rude, people like you I find annoying in life, and just get in the way when they do things like this.
|
|
#7
|
|||
|
|||
|
#8
|
||
|
||
|
Last edited by dky8810; 11-18-2008 at 11:59 AM.. Reason: Automerged Doublepost |
![]() |
|
| Bookmarks |
| Tags |
| urgent |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Urgent! Please Answer!!! | kkid | Playstation 3 | 4 | 06-30-2008 03:42 PM |
| Urgent Help | jitjot | General Tech | 3 | 05-09-2007 05:52 PM |
| URGENT!!! Request | FCXShogun | General Tech | 4 | 09-15-2006 03:33 PM |
| URGENT PRAYERS PLEASEEEEEEEE | LostForever | General Discussion | 24 | 07-22-2006 01:59 AM |