1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
schepotkina [342]
3 years ago
7

8.19 - Airline Reservations System (Project Name: Airline) - A small airline has just purchased a computer for its new automated

reservations system. You have been asked to develop the new system. You’re to write an app to assign seats on each flight of the airline’s only plane (capacity: 10 seats). Display the following alternatives: Please enter 1 for First Class or 2 for Economy. If the user types 1, your app should assign a seat in the first-class section (seats 1–5). If the user types 2, your app should assign a seat in the economy section (seats 6–10). Use a one-dimensional array of type bool 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 element of the array to true to indicate that the seat is no longer available. Your app should never assign a seat that has already been assigned. When the economy section is full, your app should ask the person if it’s 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."
Engineering
1 answer:
e-lub [12.9K]3 years ago
8 0

Answer:

The App is written in C++ language using dev C++.

Explanation:

/******************************************************************************

You can run this program in any C++ compiler like dev C++ or any online C++ compiler

*******************************************************************************/

#include <iostream>

using namespace std;

class bookingSeat// class for airline reservation system

{

  private:

   

   

  bool reserveSeat[10];// 10 seats (1-5) for first class and 6-10 for economy class

  int firstClassCounter=0;//count first class seat

  int economyClassCounter=5;//count economy class seat

  char seatPlacement;/* switch between economy and first clas seat----- a variable for making decision based on user input*/

  public:  

  void setFirstClassSeat()//

  {

      if(firstClassCounter<5)// first class seat should be in range of 1 to 5

      {

          reserveSeat[firstClassCounter]=1; /*set first class seat..... change index value to 1 meaning that it now it is reserved*/

          cout<<"Your First Class seat is booked and your seat no is "<<firstClassCounter+1; //display seat number reserved

          firstClassCounter++; //increament counter

      }

      else//in case seats are ful

      {

          cout<<"\nSeats are full";

          if(economyClassCounter==10 && firstClassCounter==5)

          {

              cout<<"\n Next flight leaves in 3 hours.";

          }

          else

          {

              cout<<"\nIt’s acceptable to be placed to you in the first-class section  y/n ";//take input from user

              cin>>seatPlacement;//user input

              if(seatPlacement=='y')//if customer want to reserve seat in first class

              {

                  setEconomyClassSeat();// then reserve first class seat

              }

              else

              {

                  cout<<"\n Next flight leaves in 3 hours.";

               }

               

          }

      }

       

  }

  void setEconomyClassSeat()//set economy class seat

  {

    if(economyClassCounter<10)//seat ranges between 6 and 10

      {

          reserveSeat[economyClassCounter]=1;// reserve economy class seat

          cout<<"Your Economy class seat is booked and your seat no is "<<economyClassCounter+1;//display reservation message about seat

          economyClassCounter++;//increament counter

      }

      else// if economy class seats are fulled

      {

          cout<<"\nSeats are full";

          if(economyClassCounter==10 && firstClassCounter==5)//check if all seats are booked in both classes

          {

              cout<<"\n Next flight leaves in 3 hours.";

          }

          else

          {

              cout<<"\nIt’s acceptable to be placed to you in the first-class section  y/n ";//take input from user

              cin>>seatPlacement;//user input

              if(seatPlacement=='y')//if customer want to reserve seat in first class

              {

                  setFirstClassSeat();// then reserve first class seat

              }

              else

              {

                  cout<<"\n Next flight leaves in 3 hours.";

               }

               

          }

      }

  }

   

   

};

int main()

{   int checkseat=10;// check seat

   int classType;//class type economy or first class

   bookingSeat bookseat;//object declaration of class bookingSeat

   while(checkseat<=10)//run the application until seats are fulled in both classes

   {

       cout<<"\nEnter 1 for First Class and 2 for Economy Class ";

       cin>>classType;//what user entered

       switch (classType)//decide which seat class to be reserved  

       {

           case 1://if user enter 1 then reserve first class seat

           bookseat.setFirstClassSeat();

           break;

           case 2://if user enter 2 then reserve the economy class seat

           bookseat.setEconomyClassSeat();

           

       }

       

   }

   

   return 0;

}

You might be interested in
Much of the workd went to bed hungry
Marysya12 [62]
The workers went to bed hungry probably because they are hard workers and so didn’t want to eat because they didn’t want to take break┌(; ̄◇ ̄)┘
7 0
3 years ago
On highways, the far left lane is usually the _____. A. emergency lane B. merge lane C. slowest D. fastest
slamgirl [31]

On highways, the far left lane is usually the<u> fastest</u> moving traffic.

Answer: Option D.

<u>Explanation:</u>

For the most part, the right lane of a freeway is for entering and leaving the traffic stream. It is an arranging path, for use toward the start and end of your interstate run. The center paths are for through traffic, and the left path is for passing. On the off chance that you are not passing somebody, try not to be driving in the left path.

Regular practice and most law on United States expressways is that the left path is saved for passing and quicker moving traffic, and that traffic utilizing the left path must respect traffic wishing to surpass.

7 0
4 years ago
Read 2 more answers
The in-situ dry density of a sand is 1.72Mg/m3. The maximum and minimum drydensities, determined by standard laboratory tests, a
Stells [14]

Answer:

Relative density = 0.7 or 70%

Explanation:

The following information was provided by this question

Pd = 1.72mg/mg³

Pd max = 1.81 mg/mg³

Pd min = 1.54 mg/mg³

We substitute into the formula. This formula is contained in the attachment.

[(1/1.54)-(1/1.72)]/[1/1.54 - 1/1.81]

= 0.649350 - 0.581395 / 0.649350 - 0.552486

= 0.067955/0.096864

= 0.7015

= 0.7

The relative density is Therefore 0.7 or 70% when converted to percentage

8 0
3 years ago
State three active materials of a lead acid cell​
igomit [66]

Answer:

lead dioxide,sulfate and lead acid

6 0
3 years ago
Read 2 more answers
What does a graphic designer need to do to monitor the progress of the project<br>​
Sholpan [36]

Answer:

At first the graphic designer has to break the process down into it's fundamental components. Which could be:

1) Discussion and Clear Comprehension of the Brief

2) Research and Collection of Information

3) Sketching

4) Execution and Experimentation

5) Finalization

6) Revision and Further Corrections

7) Submissions

Then self-analysis is required to figure out the current stage process. Project management soft-wares such as Trello could be helpful when it comes to tracking the progress. Hope this answers the question.

Explanation:

5 0
4 years ago
Other questions:
  • Determine the angular acceleration of the uniform disk if (a) the rotational inertia of the disk is ignored and (b) the inertia
    11·1 answer
  • Which of the following is an activity of daily living? jogging cleaning weightlifting all of the above
    13·1 answer
  • A classroom that normally contains 40 people is to be air-conditioned with window air-conditioning units of 5 kW cooling capacit
    6·1 answer
  • You can assume there is no pressure drop between the exit of the compressor and the entrance of the turbine. All the power from
    15·1 answer
  • If a signal is transmitted at a power of 250 mWatts (mW) and the noise in the channel is 10 uWatts (uW), if the signal BW is 20M
    13·1 answer
  • Consider the titration of 100.0 mL of 0.200 M CH3NH2 by 0.100 M HCl.
    13·1 answer
  • Who else hates this because i do
    12·2 answers
  • During the pre-drive check, you'll want to observe the car from the _______.
    9·1 answer
  • Which option identifies the type of device the engineer will develop in the following scenario?
    9·2 answers
  • In what ways did electrical switches have to change to progress from the
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!