Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write a non-functional program. C++ A small airline needs a program that assigns seats on each flight of the airline's single aircraft (20 seat

Please write a non-functional program. C++

A small airline needs a program that assigns seats on each flight of the airline's single aircraft (20 seat capacity).

The program should display the following menu of alternatives:

Please enter 1 for "smokers". Please enter 2 for "non-smokers".

If the person enters 1, a seat should be assigned in the "smoking" section (seats 1 to 10); if the person enters 2, a seat should be assigned in the "non-smoking" section (seats 11 to 20). A boarding pass should then be printed, indicating the person's seat number and whether they are in the smoking or non-smoking section of the aircraft.

Use a one-dimensional array to represent the aircraft seating chart, previously initialize all array elements to zero to indicate that all seats are empty. As each seat is assigned, set the corresponding array elements to 1 to indicate that the seat is no longer available.

The program should never assign a seat that has already been assigned. When the "smoking" section is full, the person should be asked if it is acceptable to be placed in the "non-smoking" section or vice versa. If they say yes, then make the appropriate seat assignment; if they say no, then print the message "Next flight leaves in 3 hours".

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions