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
If a car sits out in the sun every day for a long time can light from the sun damage the car paint
Reika [66]

Answer:

i think yes it could make the color go lighter

Explanation:

6 0
3 years ago
Read 2 more answers
Explain by Research how a basic generator works ? using diagram<br>​
natulia [17]
Correcto no se muy bien de que se trata el tema porque está en inglés.
Sorry
8 0
3 years ago
List two things that technological systems have in common.​
Sphinxa [80]

They all share the way that they are fundamentally designed: if they are quite complex, they will share the same basic logic foundations, like the way that the programming languages work. They also all share the method of construction and common and fundamental electronic components, like resistors, capacitors and transistors. As we humans design them, they make logical sense to at least someone, and probably only discounting the internet, you can probably draw logic diagrams and whatever to represent how they work.

Because they are designed by Humans, in a way they all mimic how our brains and society work. Also, as yet there are no truly intelligent technological systems, and are only able to react to a situation how they have been programmed to do so.

3 0
2 years ago
A car travells at 67.5 km\h in 120 km.how long will it take to reach the destination
Kruka [31]

mark me the brainiest here

average speed (in km/h) of a car stuck in traffic that drives 12 kilometers in 2 hours.

5 0
3 years ago
Determine the mass density of an oil if 0.3 tonnes of the oil occupies a volume of 4m.
Yuki888 [10]

Answer:

Do you mean 4m^3 and 3.0 tones?

Explanation:

solution:

Mass = m = 3.0 tones

- 1 ton = 1,000 kg

= 3.0 × 1,000

= 3,000 kg

volume = v = 4m^3

Required:

Mass density of oil = p = ?

We know that;

p =  \frac{mass}{volume} =  \frac{m}{v} =  \frac{3000}{4} = 750kg |m^{3} ans

The answer is:

750kg / m^3

8 0
3 years ago
Other questions:
  • The lab technician you recently hired tells you the following: Boss, an undisturbed sample of saturated clayey soil was brought
    6·1 answer
  • Which type of inappropriate practice most likely occurred if a researcher takes credit for someone else’s idea and does not ackn
    11·1 answer
  • Show that the solution of thin airfoil theory of a symmetric airfoil given below satisfies the Kutta condition. What angle of at
    11·1 answer
  • Its an opinion!!!!
    8·1 answer
  • 4. What are the basic scientific principles the engineers who designed the digital scales would have needed to understand to des
    5·1 answer
  • The inner surface of a hollow cylinder is subjected to tangential and axial stresses of 40,000 and 24,000 psi, respectively. Det
    9·1 answer
  • What should be your strongest tool be for gulding your ethical decisions making process
    5·1 answer
  • Just some random stufff
    7·1 answer
  • Kaya just bought a house and realizes that the chimney needs to be totally torn down and rebuilt. She needs to call an expert si
    6·1 answer
  • with a digital system, if you have measured incorrectly and use too low of a kvp for adequate penetration, what do you need to d
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!