To park a car, the program accepts the license plate number of the car and parks the car in Alley A, if alley A is not full. If alley A is already full, the car has to be turned away. To retrieve a car, the program asks for the license plate number of the car to be retrieved. Then each car in Alley A has to be move to alley B until it finds the desired car (and removes it from alley A). All cars that were temporarily placed in alley B are move back to alley A. ID] isplay cars parked in Alley A. [P] ark a car. (R] ctrieve a car. (Ql uit the program ID] isplay cars parked in Alley A. |P| ark a car. IR| etrieve a car. (Q) uit the program What would you like to do? D Number of cars remaining in alley A: 5 License plate numbers of cars in alley A: What would you like to do? R Enter license plate number: BND 007 Thank you. NLV 123 (open end] MML 114 LIK 019 BND 007 UMR 941 (closed end] [D] isplay cars parked in Alley A. [P] ark a car. IR] etrieve a car. IQl uit the program What would you like to do? P Enter license plate number: MXB 877 Alley A is already full. Sorry.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 21PE
icon
Related questions
Question
Create a program that simulates a parking lot consisting of two alleys Alley A and Alley B, each of which is wide enough
for only one car and closed at one end. (See illustration below) Alley A is the primary parking location while alley B is
used only as a place to move cars out of the way when retrieving a car parked in the middle of Alley A. Program
execution starts with both alleys empty. Assume that both alleys can contain at most max cars.
Alley A
Alley B
The actions to be performed are the following:
To park a car, the program accepts the license plate number of the car and parks the car in Alley A, if alley A is
not full. If alley A is already full, the car has to be turned away.
To retrieve a car, the program asks for the license plate number of the car to be retrieved. Then each car in Alley
A has to be move to alley B until it finds the desired car (and removes it from alley A). All cars that were
temporarily placed in alley B are move back to alley A.
ID] isplay cars parked in Alley A.
(P| ark a car.
[R] etrieve a car.
(Q) uit the program
[D] isplay cars parked in Alley A.
[P| ark a car.
IR] etrieve a car.
(Q) uit the program
What would you like to do? D
Number of cars remaining in alley A: 5
License plate numbers of cars in alley A:
What would you like to do? R
Enter license plate number: BND 007
Thank you.
NLV 123 Jopen end]
MML 114
LIK 019
BND 007
UMR 941 [closed end]
[D] isplay cars parked in Alley A.
[P] ark a car.
(R] etrieve a car.
(Q) uit the program
What would you like to do? P
Enter license plate number: MXB 877
Alley A is already full. Sorry.
Transcribed Image Text:Create a program that simulates a parking lot consisting of two alleys Alley A and Alley B, each of which is wide enough for only one car and closed at one end. (See illustration below) Alley A is the primary parking location while alley B is used only as a place to move cars out of the way when retrieving a car parked in the middle of Alley A. Program execution starts with both alleys empty. Assume that both alleys can contain at most max cars. Alley A Alley B The actions to be performed are the following: To park a car, the program accepts the license plate number of the car and parks the car in Alley A, if alley A is not full. If alley A is already full, the car has to be turned away. To retrieve a car, the program asks for the license plate number of the car to be retrieved. Then each car in Alley A has to be move to alley B until it finds the desired car (and removes it from alley A). All cars that were temporarily placed in alley B are move back to alley A. ID] isplay cars parked in Alley A. (P| ark a car. [R] etrieve a car. (Q) uit the program [D] isplay cars parked in Alley A. [P| ark a car. IR] etrieve a car. (Q) uit the program What would you like to do? D Number of cars remaining in alley A: 5 License plate numbers of cars in alley A: What would you like to do? R Enter license plate number: BND 007 Thank you. NLV 123 Jopen end] MML 114 LIK 019 BND 007 UMR 941 [closed end] [D] isplay cars parked in Alley A. [P] ark a car. (R] etrieve a car. (Q) uit the program What would you like to do? P Enter license plate number: MXB 877 Alley A is already full. Sorry.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Linux
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning