Question: In Java I want someone to code this so I can briefly understand the code. Must be in Java :) An office building has a
In Java I want someone to code this so I can briefly understand the code.
Must be in Java :)
An office building has a long thin car park, wide enough for just one car, with an entrance at one end. There is a road that goes around the building. No reversing or overtaking is allowed on this road. When a car arrives at the building, they enter the car park and go in as far as possible, taking the next available space. When a car wants to leave, if the car is not nearest the exit, the owner has to get all the cars that are nearer to move. They all go out onto the road, and when the person has left, they come back into the car park in the order in which they exited. . You need to simulate this by writing a class called TinyCarpark as follows: The class should have fields representing the car park and the road around the building using an appropriate data structure. The fields should be appropriately initialised. The class definition should be presented and documented to a high standard (variable names, comments, indenting, use of capital letters etc...) (20 marks) An office building has a long thin car park, wide enough for just one car, with an entrance at one end. There is a road that goes around the building. No reversing or overtaking is allowed on this road. When a car arrives at the building, they enter the car park and go in as far as possible, taking the next available space. When a car wants to leave, if the car is not nearest the exit, the owner has to get all the cars that are nearer to move. They all go out onto the road, and when the person has left, they come back into the car park in the order in which they exited. . You need to simulate this by writing a class called TinyCarpark as follows: The class should have fields representing the car park and the road around the building using an appropriate data structure. The fields should be appropriately initialised. The class definition should be presented and documented to a high standard (variable names, comments, indenting, use of capital letters etc...) (20 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
