(airline Reservations system) A small airline has justpurchased a computer for i
ID: 3608749 • Letter: #
Question
(airline Reservations system) A small airline has justpurchased a computer for its new automated reservations system. THepresident has asked you to program the new system. You are to writea program to assign seats on each flight of the airline's only plan(capacity: 10 seats).Please type 1 for "first class"
Please type 2 for "economy"
If the person types 1, then your program should assign a seat inthe first class section (seats 1-5). IF the person types 2, thenyour program should assign a seat in the economy section (seats6-10). Your program should then print a boarding pass indicatingthe person's seat number and whether it is in the first class oreconomy section of the plane.
Use a single-subscripted array to represent the seating chart ofthe plane. Initialize all the elements of the array to 0 toindicate taht all seats are empty. As each seat is assigned, setthe corresponding elements of the array to 1 indicate that seat isno longer available.
Your program should, of course, never assign a seat that hasalready been assigned. When the first class section is full, yourprogram should ask the prerson if its acceptable to be placed inthe economy section (and vice versa). If yes, then make theappropriate seat assigment. If no, then print the message "Nextflight leaves in 3 hours."
Please use C program. Do not use C++ and algorithm. I don'tknow how flowchart.
This not working my source code:
# include <stdio.h>
#include <ctype.h>
#include <string.h>
int main()
{
int Seats [ 10 ] = { 0 };
int first_class =1;
int Economy = 1;
int Customer_Input;
char Yes,No;
int i;
for (i = 1; i<10; i++)
{
printf("Please type 1 for"First Class"" );
printf("Please type 2 for"Economy"");
printf("%d", &Customer_Input);
if ( Customer_Input == 1 )
{
if ( first_class < 5 )
{
prinf( "Your First Class seatis: ", first_class);
first_class++;
}
else if ( first_class >= 5)
{
printf("The First Classsection is full. "
"Would you like to sit in the EconomySection? "
"Press 1: yes,Press 2: no.");
printf("%s%s",&Yes,&No);
if ( Yes,No == 2 )
{
printf("Next flight leaves in3 hours.");
}
else if ( Yes,No == 1 )
{
if ( Economy < 10 )
{
printf("Your Economy seat is:",Economy);
Economy++;
}
else if ( Economy >= 10)
{
printf("The Economy sectionis also full. "
"Nextflight leaves in 3 hours." );
}}}}
if ( Customer_Input == 2 )
{
if ( Economy < 10 )
{
printf("Your Economy seat is:",Economy);
Economy++;
}
else if ( Economy >= 10 ){
printf("The Economy sectionis full. ;"
"Would youlike to sit in the First Class Section? ;"
"Type 1: yes, Type 2: no.");
printf("%s%s", &Yes,&No);
if( Yes,No == 2 )
{
printf("Next flight leaves in3 hours.");
}
else if ( Yes,No == 1 )
{
if ( first_class < 5 )
{
printf("Your First Class seatis: ",first_class);
first_class++;
}
else if ( first_class >= 5 ){
printf( "The First Classsection is also full. "
"Next flight leaves in 3 hours." );
}}}}
return0;
}} (airline Reservations system) A small airline has justpurchased a computer for its new automated reservations system. THepresident has asked you to program the new system. You are to writea program to assign seats on each flight of the airline's only plan(capacity: 10 seats).
Please type 1 for "first class"
Please type 2 for "economy"
If the person types 1, then your program should assign a seat inthe first class section (seats 1-5). IF the person types 2, thenyour program should assign a seat in the economy section (seats6-10). Your program should then print a boarding pass indicatingthe person's seat number and whether it is in the first class oreconomy section of the plane.
Use a single-subscripted array to represent the seating chart ofthe plane. Initialize all the elements of the array to 0 toindicate taht all seats are empty. As each seat is assigned, setthe corresponding elements of the array to 1 indicate that seat isno longer available.
Your program should, of course, never assign a seat that hasalready been assigned. When the first class section is full, yourprogram should ask the prerson if its acceptable to be placed inthe economy section (and vice versa). If yes, then make theappropriate seat assigment. If no, then print the message "Nextflight leaves in 3 hours."
Please use C program. Do not use C++ and algorithm. I don'tknow how flowchart.
This not working my source code:
# include <stdio.h>
#include <ctype.h>
#include <string.h>
int main()
{
int Seats [ 10 ] = { 0 };
int first_class =1;
int Economy = 1;
int Customer_Input;
char Yes,No;
int i;
for (i = 1; i<10; i++)
{
printf("Please type 1 for"First Class"" );
printf("Please type 2 for"Economy"");
printf("%d", &Customer_Input);
if ( Customer_Input == 1 )
{
if ( first_class < 5 )
{
prinf( "Your First Class seatis: ", first_class);
first_class++;
}
else if ( first_class >= 5)
{
printf("The First Classsection is full. "
"Would you like to sit in the EconomySection? "
"Press 1: yes,Press 2: no.");
printf("%s%s",&Yes,&No);
if ( Yes,No == 2 )
{
printf("Next flight leaves in3 hours.");
}
else if ( Yes,No == 1 )
{
if ( Economy < 10 )
{
printf("Your Economy seat is:",Economy);
Economy++;
}
else if ( Economy >= 10)
{
printf("The Economy sectionis also full. "
"Nextflight leaves in 3 hours." );
}}}}
if ( Customer_Input == 2 )
{
if ( Economy < 10 )
{
printf("Your Economy seat is:",Economy);
Economy++;
}
else if ( Economy >= 10 ){
printf("The Economy sectionis full. ;"
"Would youlike to sit in the First Class Section? ;"
"Type 1: yes, Type 2: no.");
printf("%s%s", &Yes,&No);
if( Yes,No == 2 )
{
printf("Next flight leaves in3 hours.");
}
else if ( Yes,No == 1 )
{
if ( first_class < 5 )
{
printf("Your First Class seatis: ",first_class);
first_class++;
}
else if ( first_class >= 5 ){
printf( "The First Classsection is also full. "
"Next flight leaves in 3 hours." );
}}}}
return0;
}}
Explanation / Answer
(airline Reservations system) A small airline has justpurchased a computer for i
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.