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]
2 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]2 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
An approach to a signalized intersection has a saturation flow rate of 1800 veh/h. At the beginning of an effective red, there a
Tcecarenko [31]

Answer: The total vehicle delay is

39sec/veh

Explanation: we shall define only the values that are important to this question, so that the solution will be very clear for your understanding.

Effective red time (r) = 25sec

Arrival rate (A) = 900veh/h = 0.25veh/sec

Departure rate (D) = 1800veh/h = 0.5veh/sec

STEP1: FIND THE TRAFFIC INTENSITY (p)

p = A ÷ D

p = 0.25 ÷ 0.5 = 0.5

STEP 2: FIND THE TOTAL VEHICLE DELAY AFTER ONE CYCLE

The total vehicle delay is how long it will take a vehicle to wait on the queue, before passing.

Dt = (A × r^2) ÷ 2(1 - p)

Dt = (0.25 × 25^2) ÷ 2(1 - 0.5)

Dt = 156.25 ÷ 4 = 39.0625

Therefore the total vehicle delay after one cycle is;

Dt = 39

4 0
3 years ago
5. Create a function named second_a that uses a list comprehension. The function will take a single integer parameter n. Find ev
Mekhanik [1.2K]

Answer:

//Program was implemented using C++ Programming Language

// Comments are used for explanatory purpose

#include<iostream>

using namespace std;

unsigned int second_a(unsigned int n)

{

int r,sum=0,temp;

int first;

for(int i= 1; I<=n; i++)

{

first = n;

//Check if first digit is 3

// Remove last digit from number till only one digit is left

while(first >= 10)

{

first = first / 10;

}

if(first == 3) // if first digit is 3

{

//Check if n is palindrome

temp=n; // save the value of n in a temporary Variable

while(n>0)

{

r=n%10; //getting remainder

sum=(sum*10)+r;

n=n/10;

}

if(temp==sum)

cout<<n<<" is a palindrome";

else

cout<<n<<" is not a palindrome";

}

}

}

Explanation:

The above code segments is a functional program that checks if a number that starts with digit 3 is Palindromic or not.

The program was coded using C++ programming language.

The main method of the program is omitted.

Comments were used for explanatory purpose.

8 0
2 years ago
Need help with both giving out brainlest for the people to help me
sammy [17]
The first one is d or the 4th answer choice and the second one is false. Hope this helps!
4 0
2 years ago
A steam power plant is represented as a heat engine operating between two thermal reservoirs at 800 K and 300 K. The temperature
Sergeeva-Olga [200]
Yeet is the answer .....
4 0
2 years ago
Side milling cutter is an example of ______ milling cutter.
dusya [7]

Answer:

special type

Explanation:

As per the classification of milling cutters. This cutter can handle deep and long open slots in a more comfortable manner, which increase the productivity.

6 0
3 years ago
Other questions:
  • Ion 2 23
    10·1 answer
  • The statement that is NOT true about the difference between laminar and turbulent boundary layers is:1.the Reynolds number for a
    8·1 answer
  • Block B starts from rest and moves downward with a constant acceleration. Knowing that after slider block A has moved 400 mm its
    13·1 answer
  • There are two questions about SolidWorks.
    9·1 answer
  • The European Space Agency launched a probe called Rosetta in March 2004. In August​ 2014, Rosetta reached its​ destination: a co
    13·1 answer
  • Argon is compressed in a polytropic process with n = 1.2 from 100 kPa and 30°C to 1200 kPa in a piston–cylinder device. Determin
    14·1 answer
  • Which of the following answers regarding Mealy and Moore Machines are true?
    7·1 answer
  • The purpose of the __________ algorithm is to enable two users to exchange a secret key securely that can then be used for subse
    8·1 answer
  • Can U lose a rank in Brainly by using too many points?
    6·1 answer
  • Select the correct answer. Jude is a mechanical engineer. He works in the automobile industry. He is creating a prototype of an
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!