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
When you arrive at an intersection with a stop sign in your direction, if there is no marked stop
Illusion [34]

Answer:

C: Stop before entering the pedestrian crosswalk.

Explanation:

3 0
3 years ago
Read 2 more answers
Select the correct answer.
Ulleksa [173]
The answer is A. Immediately inform her colleague
4 0
3 years ago
In order to avoid a rollover, what is the highest degree incline one should mow on? 10-degree incline 5-degree incline 30-degree
ser-zykov [4K]

Answer: B: 20-degree incline

Explanation:

A tractor user should avoid slopes of more than 20 degrees in order to avoid rollovers

6 0
2 years ago
Tech A says that speed density systems use vehicle speed and fuel density to determine injector pulse width. Tech B says that ma
bogdanovich [222]

The person that is correct based on the 2 statements from Tech A and Tech B is; Tech B

A mass flow sensor is defined as a sensor that is used to measure the mass flow rate of air entering a fuel-injected internal combustion engine and then sends a voltage that represents the airflow to the electronic control circuit.

However, for Tech A is incorrect and so the correct answer is that Tech B is right because his statement corresponds with the definition of mass flow sensor.

Read more about fuel injection engines at; brainly.com/question/4561445

8 0
2 years ago
What was the role of the rotors in the enigma machine?.
Lisa [10]

Answer:

Implements a reordering of the letters of the alphabet.

Explanation: GIVE ME 5 STARS AND a HEART!!!                                      Those contacts are wired across the rotor so that each contact on the left connects to the contact on the right in some scrambled arrangement. Each rotor, therefore, implements a reordering of the letters of the alphabet, which mathematicians call a permutation.

3 0
3 years ago
Other questions:
  • Air is compressed adiabatically from p1 1 bar, T1 300 K to p2 15 bar, v2 0.1227 m3 /kg. The air is then cooled at constant volum
    13·1 answer
  • What is the first step in the problem-solving process, as well as in the engineering design process?
    7·1 answer
  • A student is using a 12.9 ft ramp to raise an object 6 ft above the ground.
    5·1 answer
  • Represent the following sentence by a Boolean expression:
    11·1 answer
  • Discuss the impact of the changing urban center. Include the impacts on political, economic, and social roles and opportunities.
    12·1 answer
  • The costs of mining and transporting coal are roughly independent of the heating value of the coal. Consider:
    15·1 answer
  • Tech A says that proper footwear may include both leather and steel-toed shoes. Tech B says that when working in the shop, you o
    15·1 answer
  • Safety-in engineering as with everything else is all about trying to maximize or create the hazards involved with what you are d
    6·2 answers
  • Oleg is using a multimeter to test the circuit branch you just installed. After turning off the current to the circuit at the se
    5·1 answer
  • 10 properties of metals?<br> ​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!