1

# Question: How can I solve it in "Java program"?, i need test code also. Define Pi...

## Question

###### Question: How can I solve it in "Java program"?, i need test code also. Define Pi...

Question: How can I solve it in "Java program"?, i need test code also.

Define Pi to be a parking lane i in a parking lot and carj to be the jth car; where the number of lanes in a parking lot is 4 and there are 7 cars to park. 1<= i<=4, and Cj: 1<=j<=7. Assume that all lanes are of the same length, and all cars are also of the same length, hence, the same number of cars could be lined up in each lane. Only 5 cars can be lined up in each lane. However, different lanes have different lining up rules according to their data structures. The first parking lot lane is an array, the second is a single listed, and the third is a stack.

Parking lot line - Structure

P1 - Array

P3 - Stack

When a car arrives to the parking lot, the valet parking lot staff insert the car in one of lanes. However, customers may also ask the staff to get their cars back later. Keep in mind that any (inserting/ removing) operation (corresponding to moving any car into or out of any lanes) cost 1 KD.

Test the program on each data structure using the following Insert operations.

lane operation - Car Number

Insert - C1

Insert - C4

Remove - C1

Insert - C5

Insert - C7

Insert - C3

Insert - C2

Remove - C2

Insert - C1

Remove - C7

Insert - C6

Remove - C1

Define P to be a parking lane i in a parking lot and car; to be the jth car, where the number of lanes in a parking lot is 4 and there are 7 cars to park. 1<=i<-4, and Cj: 1<=j<=7. Assume that all lanes are of the same length, and all cars are also of the same length, hence, the same number of cars could be lined up in each lane. Only 5 cars can be lined up in cach lane. However, different lanes have different lining up rules according to their data structures. The first parking lot lane is an array, the second is a single listed, and the third is a stack. Parking lot line Structure Array Single Linked List Stack When a car arrives to the parking lot, the valet parking lot staff insert the car in one of lanes. However, customers may also ask the staff to get their cars back later. Keep in mind that any inserting/removing) operation (corresponding to moving any car into or out of any lanes) cost 1 KD Test the program on each data structure using the following Insert operations lane operation Car Number Insert Insert Remove Insert Insert Insert Insert Remove Insert Remove Insert Remove 8 do 0000000000

#### Similar Solved Questions

##### Help Seve&Exit Submit Check my work QS 21-19B Variable costing income statement LO P5 Aces Inc.,...
Help Seve&Exit Submit Check my work QS 21-19B Variable costing income statement LO P5 Aces Inc., a manufacturer of t ennis rackets, began operations this year. The company produced 6.200 rackets and sold 5,100 Each racket was sold at a price of \$92. Fixed overhead costs are \$81,840, and fixed se...
##### Starts from rest and at +2.01 m/s? for 7.25 s. At the end of this time,...
starts from rest and at +2.01 m/s? for 7.25 s. At the end of this time, the boat 6.10 s with an this, the boat accelerates at -1.49 m/s? for 7.80 What is the velocity of the boat att 21.15 s m/s (b) Find the total displacement of the boat...
##### Construct a cumulative frequency distribution of the 20 brain volumes(cm3) listed below. Use the classes 900-999,...
Construct a cumulative frequency distribution of the 20 brain volumes(cm3) listed below. Use the classes 900-999, 1000-1099, and so on. (6-classes) 1005   963 1035 1027 1281 1272 1051 1079 1034 1070 1173 1079 1067 1104 1347 1439 1029 1100 1204 1160.Also find relative frequency for each cl...
##### P2.7-1 Ammeter 11 455 V Voltmeter 4? 18v ( Determine the value of r, the gain...
P2.7-1 Ammeter 11 455 V Voltmeter 4? 18v ( Determine the value of r, the gain of the CCvS in this circuit: the tolerance is +7.2% .corned gen/shared/assignment/test/agist un?idsasnmt22076 55#N1008C...
##### 5. There are 12 people on a basketball team, and the coach needs to choose 5...
5. There are 12 people on a basketball team, and the coach needs to choose 5 to put into a game. How many different possible ways can the coach choose a team of 5 if each person has an equal chance of being selected? (1) 12Ps (3) 12Cs (2) sP12 4) sCi2...
##### A very long, straight wire carries a constant current.
A very long, straight wire carries a constant current. The magnetic field a distance d from the wire and far from its ends varies with distance d according toA) d^-3B) dC) d^2D) d^-1E) d^-2...
##### Two pyramids are similar. Pyramid A has a volume of 32m^3 and with a surface area of 100m^2 while Pyramid B has a volume of 500m^3 and is 60m tall. What is the height of Pyramid A? What is the surface area of Pyramid B?
Two pyramids are similar. Pyramid A has a volume of 32m^3 and with a surface area of 100m^2 while Pyramid B has a volume of 500m^3 and is 60m tall. What is the height of Pyramid A? What is the surface area of Pyramid B?...
##### Type your answer in the box. Two capital budgeting approaches that use discounted cash flows are...
Type your answer in the box. Two capital budgeting approaches that use discounted cash flows are the value method and the return method. (Enter only one word per blank.) When the cash flows associated with an investment project change from year to year, the payback period must be calculated: Click t...
##### With explanation please Question 18 O out of 1.5 points During 2019, Hadley Merchandising Company purchased...
With explanation please Question 18 O out of 1.5 points During 2019, Hadley Merchandising Company purchased \$34,843 of inventory on account. Hadley sold inventory on account that cost \$19,854 for \$35,089. Cash payments on accounts payable were \$21,685. There was \$26,756 cash collected from accounts ...
##### How many isomers can a formula of #C_4H_10O# generate?
How many isomers can a formula of #C_4H_10O# generate?...
##### Homework help question 9 multiple choice .Boost 1:58 PM 1 39% < Back Econ 2 -...
homework help question 9 multiple choice .Boost 1:58 PM 1 39% < Back Econ 2 - Final... a @ best explain the Which of the following changes in the electricitymarket ice of electricity! An increase in demand and a decrease in pply Ademain demand and supply As b e demand supply Ademain both deman...