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...


Create a program that simulates a parking lot consisting of two alleys Alley A and Alley B, each of which is wide enough<br>for only one car and closed at one end. (See illustration below) Alley A is the primary parking location while alley B is<br>used only as a place to move cars out of the way when retrieving a car parked in the middle of Alley A. Program<br>execution starts with both alleys empty. Assume that both alleys can contain at most max cars.<br>Alley A<br>Alley B<br>The actions to be performed are the following:<br>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<br>not full. If alley A is already full, the car has to be turned away.<br>To retrieve a car, the program asks for the license plate number of the car to be retrieved. Then each car in Alley<br>A has to be move to alley B until it finds the desired car (and removes it from alley A). All cars that were<br>temporarily placed in alley B are move back to alley A.<br>ID] isplay cars parked in Alley A.<br>(P| ark a car.<br>[R] etrieve a car.<br>(Q) uit the program<br>[D] isplay cars parked in Alley A.<br>[P| ark a car.<br>IR] etrieve a car.<br>(Q) uit the program<br>What would you like to do? D<br>Number of cars remaining in alley A: 5<br>License plate numbers of cars in alley A:<br>What would you like to do? R<br>Enter license plate number: BND 007<br>Thank you.<br>NLV 123 Jopen end]<br>MML 114<br>LIK 019<br>BND 007<br>UMR 941 [closed end]<br>[D] isplay cars parked in Alley A.<br>[P] ark a car.<br>(R] etrieve a car.<br>(Q) uit the program<br>What would you like to do? P<br>Enter license plate number: MXB 877<br>Alley A is already full. Sorry.<br>

Extracted 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.
Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here