Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A small airline has just purchased a computer for its new automated reservations

ID: 3623422 • Letter: A

Question

A small airline has just purchased a computer for its new automated reservations system. You have been asked to develop the new system. You are to write an application to assign seats on each flight of the airline’s only plane (capacity: 10 seats).

Your application should display the following alternatives: Please type 1 for First Class and
Please type 2 for Economy.
If the user types 1, your application should assign a seat in the firstclass section (seats 1–5).
If the user types 2, your application should assign a seat in the economy section (seats 6–10).

Your application should then display a boarding pass indicating the person’s seat number and whether it is in the first-class or economy section of the plane.

Use a one-dimensional array of primitive type boolean to represent the seating chart of the plane. Initialize all the elements of the array to false to indicate that all the seats are empty. As each seat is assigned, set the corresponding elements of the array to true to indicate that the seat is
no longer available.

Your application should never assign a seat that has already been assigned. When the economy section is full, your application should ask the person if it is acceptable to be placed in the first-class section (and vice versa). If yes, make the appropriate seat assignment. If no, display the message "Next flight leaves in 3 hours."

Explanation / Answer

please rate - thanks

you didn't say what language

#include <stdio.h>
#include <conio.h>
int main ()
{
int Seats [ 20 ] = { 0 };
int Smoking = 0;
int Nonsmoking= 10;
int Input,assigned=0;
while(assigned<20)
{
   printf("Please type 1 for "Smoking" " );
   printf("Please type 2 for "Non-smoking" ");
   scanf("%d", &Input);
   if ( Input == 1 )
      {if ( Smoking < 10 )
         {Seats[Smoking]=1;
          printf( " BOARDING PASS Your SMOKING seat is seat: %d ", Smoking+1);
          Smoking++;
          assigned++;
          }
        else
          {
             printf("The Smoking section is full. ");
             printf("Next flight leaves in 3 hours. ");
           }
        }
      else if(Input==2)
          {if ( Nonsmoking <20 )
                  {Seats[Nonsmoking]=1;
                   printf(" BOARDING PASS Your NON SMOKING seat is: %d ",Nonsmoking+1);
                   Nonsmoking++;
                   assigned++;
                  }
               else
                   {printf("The Non Smoking section is full. ;");
                    printf("Next flight leaves in 3 hours. ");
                   }
            }
}
getch();
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote