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
A parallel plates capacitor is filled with a dielectric of relative permittivity ε = 12 and a conductivity σ = 10^-10 S/m. The c
monitta

Answer:

t = 1.06 sec

Explanation:

Once disconnected from the battery, the capacitor discharges through the internal resistance of the dielectric, which can be expressed as follows:

R = (1/σ)*d/A, where d is is the separation between plates, and A is the area of one of  the plates.

The capacitance C , for a parallel plates capacitor filled with a dielectric of a relative permittivity ε, can be expressed in this way:

C = ε₀*ε*A/d = 8.85*10⁻¹² *12*A/d

The voltage in the capacitor (which is proportional to the residual charge as it discharges through the resistance of the dielectric) follows an exponential decay, as follows:

V = V₀*e(-t/RC)

The product RC (which is called the time constant of the circuit) can be calculated as follows:

R*C = (1/10⁻¹⁰)*d/A*8.85*10⁻¹² *12*A/d

Simplifying common terms, we finally have:

R*C = 8.85*10⁻¹² *12 / (1/10⁻¹⁰) sec = 1.06 sec

If we want to know the time at which the voltage will decay to 3.67 V, we can write the following expression:

V= V₀*e(-t/RC) ⇒ e(-t/RC) = 3.67/10 ⇒ -t/RC = ln(3.67/10)= -1

⇒ t = RC = 1.06 sec.

3 0
3 years ago
All of these are true about GMA (MIG) welding EXCEPT that:
Hatshy [7]

Answer:

the welding gun liner regulates the shielding gas.

Explanation:

The purpose of the welding gun liner is to properly position the welding wire from the wire feeder till it gets to the nozzle or contact tip of the gun. <em>Regulation of the shielding gas depends on factors such as the speed, current, and type of gas being used. </em>In gas metal arc welding, an electric arc is used to generate heat which melts both the electrode and the workpiece or base metal.

The electric arc produced is shielded from contamination by the shielding gas. The heat generated by the short electric arc is low.

3 0
2 years ago
Zachary finished an internship as a Software Quality Assurance Engineer. For which job is he best qualified?
astra-53 [7]

Answer:

B. A software development firm needs someone to find and fix bugs on multiple computer platforms.

Explanation:

A software quality assurance engineer is someone who monitors every phase of the software development process so as to ensure design quality, making sure that the software adheres to the standards set by the development company. Finding bugs would make this intern a amazing bug finder

6 0
3 years ago
Read 2 more answers
A ductile hot-rolled steel bar has a minimum yield strength in tension and compression of Syt = 60 kpsi and Syc = 75 kpsi. Using
kow [346]

Answer:

2.135

Explanation:

Lets make use of these variables

Ox 16.5 kpsi, and Oy --14,5 kpsi

To determine the factor of safety for the states of plane stress. We have to first understand the concept of Coulomb-Mohr theory.

Mohr–Coulomb theory is a mathematical model describing the response of brittle materials such as concrete, or rubble piles, to shear stress as well as normal stress.

Please refer to attachment for the step by step solution.

4 0
3 years ago
Select the correct statement(s) regarding frequency modulation (FM). a. baseband amplitude changes (information) are captured as
mario62 [17]
<h3>All of the above statement are correct statement.</h3>

<u>Explanation</u>

  • Base-Band amplitude changes are captured as carrier wave wave frequency changes. In order to convert signal amplitude changes to changes in frequency, we need a device like VCO.
  • The bandwidth in the frequency domain increases with the change in carrier frequency.

3 0
3 years ago
Other questions:
  • Bulk wind shear is calculated by finding the vector difference between the winds at two different heights. Using the supercell w
    12·1 answer
  • Why do we write proton ions first before electron ions? <br>​
    10·1 answer
  • A 1000 KVA three phase transformer has a secondary voltage of 208/120. What is the secondary full load amperage?
    9·1 answer
  • Will this airplane stay in the air a long time? Why or why not?
    9·1 answer
  • A steam power plant operating on a simple ideal Rankine cycle maintains the boiler at 6000 kPa, the turbine inlet at 600 °C, and
    11·1 answer
  • A car radiator is a cross-flow heat exchanger with both fluids unmixed. Water, which has a flow rate of 0.05 kg/s, enters the ra
    15·1 answer
  • A room is kept at −5°C by a vapor-compression refrigeration cycle with R-134a as the refrigerant. Heat is rejected to cooling wa
    7·2 answers
  • Could I please get help with this​
    11·1 answer
  • A machine has an efficiency of 15%. If the energy input is 300 joules, how much useful energy is generated?(1 point).
    8·1 answer
  • which of the following statements are true about client-side DNS? (Choose all that apply). a. If an APIPA address is assigned, t
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!