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 turmed 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. [D] isplay cars parked in Alley A. (P| ark a car. [R] etrieve a car. (Q) uit the program ID| isplay cars parked in Alley A. Pj ark a car. R] etrieve a car. İQj 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 LJK 019 BND 007 UMR 941 [closed end] [D] isplay cars parked in Alley A. [P] ark a car. [R] etrieve a car. iQj uit the program What would you like to do? P Enter license plate number: MXB 877 Alley A is already full. Sorry.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Solve it? 

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 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY