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
PLEASE HELPPPPPPP!!!!,
raketka [301]


software engineers

hardware engineers

metallurgic engineers

biomechanical engineers
4 0
3 years ago
Read 2 more answers
A sleeve made of SAE 4150 annealed steel has a nominal inside diameter of 3.0 inches and an outside diameter of 4.0 inches. It i
irga5000 [103]

Answer:

Class of fit:

Interference (Medium Drive Force Fits constitute a special type of Interference Fits and these are the tightest fits where accuracy is important).

Here minimum shaft diameter will be greater than the maximum hole diameter.

Medium Drive Force Fits are FN 2 Fits.

As per standard ANSI B4.1 :

Desired Tolerance: FN 2

Tolerance TZone: H7S6

Max Shaft Diameter: 3.0029

Min Shaft Diameter: 3.0022

Max Hole Diameter:3.0012

Min Hole Diameter: 3.0000

Max Interference: 0.0029

Min Interference: 0.0010

Stress in the shaft and sleeve can be considered as the compressive stress which can be determined using load/interference area.

Design is acceptable If compressive stress induced due to selected dimensions and load is less than compressive strength of the material.

Explanation:

4 0
4 years ago
Read 2 more answers
The A-36 steel pipe has a 6061-T6 aluminum core. It issubjected to a tensile force of 200 kN. Determine the averagenormal stress
sasho [114]

Answer:

In the steel: 815 kPa

In the aluminum: 270 kPa

Explanation:

The steel pipe will have a section of:

A1 = π/4 * (D^2 - d^2)

A1 = π/4 * (0.8^2 - 0.7^2) = 0.1178 m^2

The aluminum core:

A2 = π/4 * d^2

A2 = π/4 * 0.7^2 = 0.3848 m^2

The parts will have a certain stiffness:

k = E * A/l

We don't know their length, so we can consider this as stiffness per unit of length

k = E * A

For the steel pipe:

E = 210 GPa (for steel)

k1 = 210*10^9 * 0.1178 = 2.47*10^10 N

For the aluminum:

E = 70 GPa

k2 = 70*10^9 * 0.3848 = 2.69*10^10 N

Hooke's law:

Δd = f / k

Since we are using stiffness per unit of length we use stretching per unit of length:

ε = f / k

When the force is distributed between both materials will stretch the same length:

f = f1 + f2

f1 / k1 = f2/ k2

Replacing:

f1 = f - f2

(f - f2) / k1 = f2 / k2

f/k1 - f2/k1 = f2/k2

f/k1 = f2 * (1/k2 + 1/k1)

f2 = (f/k1) / (1/k2 + 1/k1)

f2 = (200000/2.47*10^10) / (1/2.69*10^10 + 1/2.47*10^10) = 104000 N = 104 KN

f1 = 200 - 104 = 96 kN

Then we calculate the stresses:

σ1 = f1/A1 = 96000 / 0.1178 = 815000 Pa = 815 kPa

σ2 = f2/A2 = 104000 / 0.3848 = 270000 Pa = 270 kPa

5 0
3 years ago
If pure oxygen is fed in excess by 25%, what would the fractional conversion of methane be for the final concentration of CO2 in
inessss [21]

Answer:the fractional conversion of methane is 12.5%

Explanation:The reaction represent the combustion of methane to produce Co2 and steam.

CH4 +2O2_CO2 + 2H2O

From gay lussac law of proportionality

1mol of CH4 requires 2mol of Oxygen to produce 1 mol of CO2 and 2mol of H2O

So from the combining ratio,25% of O2 will fractional produce 25×1/2% of CH4.

While 12.5% of CO2 and 25% of steam is also produced .so in essence 2.5% of CO2 was lost in the reaction.

7 0
4 years ago
During the era of known as the Stone Age, no tools were used and no technology was created.
Shtirlitz [24]

Answer:

stone wheel

Explanation:

it was built around 3500 B.C.

5 0
4 years ago
Other questions:
  • What are the four categories of engineering materials used in manufacturing?
    9·1 answer
  • A pump collects water (rho = 1000 kg/m^3) from the top of one reservoir and pumps it uphill to the top of another reservoir with
    13·1 answer
  • A compressor operates at steady state with Refrigerant 134a as the working fluid. The refrigerant enters at 0.24 MPa, 0°C, with
    8·1 answer
  • The job objective on your resume should be vague so as to leave all of your options open.
    12·1 answer
  • cubical tank 1 meter on each edge is filled with water at 20 degrees C. A cubical pure copper block 0.46 meters on each edge wit
    6·1 answer
  • LET'S DO THIS! Here are the directions whoever answers first will get the brainliest! I Promise!
    12·1 answer
  • Technician A says that some vehicle makers do NOT apply undercoating to the floor pan. Technician B says that some vehicle maker
    11·1 answer
  • How many flip-flop values are complemented in an 8-bit binary ripple counter to reach the next count value after: 0110111 and 01
    6·1 answer
  • What is the relationship between compressor work and COPR?
    14·1 answer
  • Most of the energy used by the built environment comes from what source?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!