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
About ceramics: Only can be optically opaque or semi-transparent. a) True b)-False
julia-pushkina [17]

Answer: True

Explanation: Ceramics have the property that when the band gap present between the atoms are larger than the light energy then the tend to become opaque because the light scattering is caused . They also show the property of being translucent when there are chances of the light to get a path through the surface of ceramic so they get the light at some parts e.g.porcelain .Therefore the statement given is true that ceramics can be optically opaque or semi-transparent(translucent).

6 0
3 years ago
50POINTS
maxonik [38]

Answer:

Ensure that all material and energy inputs and outputs are as inherently safe and benign as possible. Minimize the depletion of natural resources. Prevent waste. Develop and apply engineering solutions while being cognizant of local geography, aspirations, and cultures.Green engineering is the design, commercialization, and use of processes and products that minimize pollution, promote sustainability, and protect human health without sacrificing economic viability and efficiency.The goal of environmental engineering is to ensure that societal development and the use of water, land and air resources are sustainable. This goal is achieved by managing these resources so that environmental pollution and degradation is minimized.

Explanation:i helped

7 0
3 years ago
Read 2 more answers
1.Which thematic group uses technology to direct the behavior of dynamical systems, ensuring that they behave in a predictable m
dsp73

The thematic group governing the behavior of dynamic system is control system, and the one packaging the miniature components to conduct electricity is electronic system. Thus, option E is correct.

<h3>What are thematic groups?</h3>

The thematic groups comprises of group of people that work over the same idea or the concept. The thematic groups working on different projects and ideas comprised to work with different systems.

The control of dynamic system in order to produce the desirable outcome has been the role of the control system.

The packaging of the electronic miniatures in system that performs the role of direction of electricity is the role of electronic system thematic group. Thus, option E is correct.

Learn more about thematic group, here:

brainly.com/question/32731

#SPJ1

8 0
2 years ago
X-Ray Inspection
Softa [21]
The answer is the test is being tested towards the lungs the test is done by scanning your body the tools are called “the x rat visional lock space” and the rubber tool is called a deeldo it’s purple with a pencil looking shape perfect for the body.
5 0
3 years ago
Which of these is a scientific question
Paraphin [41]
The answer is B: How long does it take for bread dough to ferment
7 0
3 years ago
Read 2 more answers
Other questions:
  • Inspection with considering a variable uses gages to determine if the product is good or bad. True or False?
    15·2 answers
  • The penalty for littering 15 lb or less is _____.<br> A. $25<br> B. $50<br> C. $100<br> D. $150
    14·1 answer
  • How did humans create a space suit without ever going. How did we know spaces conditions?
    5·2 answers
  • Which of the following is an example of an observation?
    8·2 answers
  • The thermal energy is carried by electromagnetic waves
    12·1 answer
  • Which step in the engineering design phase is requiring concussion prevention from blows up to 40 mph an example of?
    6·1 answer
  • What’s the answer???
    9·1 answer
  • 3<br> Current is measured in units called
    6·2 answers
  • What is another term for the notes that a reader can add to text in a word-processing document?
    11·2 answers
  • 1)What are the three previous manufacturing revolutions Mr. Scalabre mentions? When did these take place?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!