with 4 seats in each row. Rows 1 and 2 are first class; Output the seating plan in the following format: В C D Row 1 * Row 2 Row 3 Ρο Λ * X * * > * X * A * * X ►

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

This code must be written in c++, I am having some trouble. Please help!

Write a C++ program that will assign seats for a commercial airplane. The airplane has 9 rows
with 4 seats in each row. Rows 1 and 2 are first class; the remaining rows are economy class.
Output the seating plan in the following format:
А
B
C
Row 1
Row 2
Row 3
X
Row 4
*
Row 5
*
Row 6
*
*
Row 7
*
*
Row 8
*
*
Row 9
X
X
Here, * indicates the seat is available and X indicates the seat is occupied.
МЕТНOD
The top level of this program should look like:
initialize all seats to empty (*')
do
display seating plan
ask user to enter data
assign seat
continue?
while more requests
display seating plan
INPUT
The data consists of a series of requests for seats on the plane. Each request consists of four
parts:
(string – contains both first & last name)
(enum type – FIRST or COACH)
(character)
customer name
class
seat row
A * * X * X * X * X
U X * * X *
X * *
A * *
< * * X>
Transcribed Image Text:Write a C++ program that will assign seats for a commercial airplane. The airplane has 9 rows with 4 seats in each row. Rows 1 and 2 are first class; the remaining rows are economy class. Output the seating plan in the following format: А B C Row 1 Row 2 Row 3 X Row 4 * Row 5 * Row 6 * * Row 7 * * Row 8 * * Row 9 X X Here, * indicates the seat is available and X indicates the seat is occupied. МЕТНOD The top level of this program should look like: initialize all seats to empty (*') do display seating plan ask user to enter data assign seat continue? while more requests display seating plan INPUT The data consists of a series of requests for seats on the plane. Each request consists of four parts: (string – contains both first & last name) (enum type – FIRST or COACH) (character) customer name class seat row A * * X * X * X * X U X * * X * X * * A * * < * * X>
class
FIRST or COACH)
enum type
(character)
(character)
seat row
seat column
Assumptions:
> Check for out-of-range errors (rows 1-9 and columns A-D) when reading in data – force
the user to correct seat entry.
> If the requested seat is occupied and there is an available seat in that class, force the user
to re-enter seat.
> If there is a request for first class and first class is full but there are available seats in
economy class, place the customer in the first available seat in economy class.
> If there is a request for economy class and economy class is full but there are available
seats in first class, place the customer in the last available seat in first class.
P#1 Airplane Seating 2-dim array.docx
> There is an unknown amount of data.
OUTPUT
For each request, print out all input information along with appropriate messages including
which seat was assigned to the customer or any "weird" action that was taken to find a seat.
Make sure output is clear, easy to read, and labelled appropriately. Output should go to a file.
DATA STRUCTURES
You will need a two-dimensional array to store the seat plan – each entry should be a single
character (**' or 'X'). Make the class variable an enumerated user-defined data type with FIRST
and COACH as its possible values. Use a linear search to find the next available seat when a
requested section is full. Do not access variables globally – enumerated data types and constants
should be global. Use static allocation of the array – do not use pointers, standard libraries, or
classes. Most of the work should be performed in functions. Eliminate redundant code. Input
data does not need to be retained after the seat has been assigned.
Transcribed Image Text:class FIRST or COACH) enum type (character) (character) seat row seat column Assumptions: > Check for out-of-range errors (rows 1-9 and columns A-D) when reading in data – force the user to correct seat entry. > If the requested seat is occupied and there is an available seat in that class, force the user to re-enter seat. > If there is a request for first class and first class is full but there are available seats in economy class, place the customer in the first available seat in economy class. > If there is a request for economy class and economy class is full but there are available seats in first class, place the customer in the last available seat in first class. P#1 Airplane Seating 2-dim array.docx > There is an unknown amount of data. OUTPUT For each request, print out all input information along with appropriate messages including which seat was assigned to the customer or any "weird" action that was taken to find a seat. Make sure output is clear, easy to read, and labelled appropriately. Output should go to a file. DATA STRUCTURES You will need a two-dimensional array to store the seat plan – each entry should be a single character (**' or 'X'). Make the class variable an enumerated user-defined data type with FIRST and COACH as its possible values. Use a linear search to find the next available seat when a requested section is full. Do not access variables globally – enumerated data types and constants should be global. Use static allocation of the array – do not use pointers, standard libraries, or classes. Most of the work should be performed in functions. Eliminate redundant code. Input data does not need to be retained after the seat has been assigned.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
ASCII Codes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education