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
What combustion after effects do actuators work to control
Rufina [12.5K]
Answer: I would help you but I don’t know the answer, so sorry
4 0
3 years ago
Read 2 more answers
Which of the following is the last step in creating a budget?
Greeley [361]

Answer:

<em>D. Determine saving or debt</em>

Explanation:

7 0
3 years ago
Calculate the theoretical density of FCC iron (eg. austenitic stainless steel). The lattice parameter for FCC iron is 0.357 nm a
Ann [662]

Answer: 12.4 feet

Explanation:

If there is a smooth transition and there is no change in slopes, energy considerations can be used

The cube has a kinetic energy of

ke = mv^2/2 = 10 lbm * 20^2ft^2/s^2 / 2 = 2000 lbm-ft^2 / s^2

At the highest point when there is a gain in potential energy

pe = mgh = 10 lbm * 32.2 ft/s^2 * h ft = 322 lbm ft^2/s^2

If there is no loss in energies,

pe = ke

322h lbm ft^2/s^2 = 2000 lbm ft^2/s^2

h = 2000 /322 = 6.211 (ft)

= h / sin(30) = 12.4 ft

8 0
3 years ago
A homogeneous 800kg bar AB is supported at either end by a cable asshown in the figure
aleksandr82 [10.1K]

The smallest area of each cable if the stress is not to exceed 90MPa in bronze is 43.6 mm² and 120MPa in steel is 32.7 mm².

<h3>What is normal stress?</h3>

If the direction of deformation force is perpendicular to the cross-sectional area of ​​the body, the stress is called normal stress. Changes in wire length and body volume will be normal.

σ = P/A

Where, σ = Normal stress

P = Pressure

A = Area

1 Kg = 9.81 N

800 kg = 7848 N

Since the rod is half bronze and half steel

800 kg = 7848/2

= 3924 N

Pₙ = Fₙ = 3924 N                       [n = Bronze]

Pₓ =  3924 N                             [x = steel]

Given,

σₙ = 90MPa

σₓ = 120MPa

Aₙ = ?

Aₓ = ?

Aₙ = Pₙ/σₙ

Aₙ = 3924/90

Aₙ = 43.6 mm²

Aₓ = Pₓ/σₓ

Aₓ = 3924/120

Aₓ = 32.7 mm²

To know more about normal stress, visit:

brainly.com/question/28012990

#SPJ9

4 0
1 year ago
The National Park Service is waiting on your recommendation.
maksim [4K]

The hypothesis that would help restore equilibrium is reintroduce wolves in the park or into the forest.

<h3>What is  reintroduce?</h3>

To reintroduce, is a term that means to revive, reinstate, or bring back something.

Note that based on the right recommendation needed by National Park Service, one can say that the best hypothesis that would help restore equilibrium is reintroduce wolves in the park or into the forest  as it will help restore balance.

Learn more about hypothesis from

brainly.com/question/24149728

#SPJ1

8 0
2 years ago
Other questions:
  • How much to build a barber clipper?
    10·1 answer
  • A socket can be driven using any of the following except for (A) a socket ratchet
    14·1 answer
  • Name the important trees of tropical monsoon forest​
    11·1 answer
  • A sheet of steel 3-mm thick has nitrogen atomospheres on both sides at 900 C and is permitted to achieve a steady-state di usion
    6·1 answer
  • The air loss rate for a straight truck or bus with the engine off and the brakes
    11·1 answer
  • The displacement of a certain object is described by y(t) = 23 sin 5t, where t is measured in seconds. Compute its period and it
    9·1 answer
  • What kind of analysis would be conducted to identify project costs?
    11·1 answer
  • What is the name of the type of rocker arm stud that does not require a valve adjustment?
    12·1 answer
  • A device that transforms electrical energy to mechanical:
    5·1 answer
  • Analyze the example of this band saw wheel and axle. The diameter of the wheel is 14 inches. The diameter of the axle that drive
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!