Question: ***IF POSSIBLE COMMENT WHAT EACH LINE DOES*** 1. The floors of the building are numbered 1 to 12 2. At the start of the program,
***IF POSSIBLE COMMENT WHAT EACH LINE DOES***





1. The floors of the building are numbered 1 to 12 2. At the start of the program, randomly generate 8 of the 12 floors to stop at while going up. These must be placed in an ArrayList which should be sorted in ascending order. Also generate another set of 5 numbers representing floors to stop at when going down and place it in another ArrayList. Sort this ArrayList in descending order. 3. Also at the start of the program the elevator must be located on the 1st floor and the first request is made from the ArrayList which must be a request to go up. From the 1st floor, the elevator can only go in one direction - up. And from the 12th floor the elevator can only go in one direction- down 4. 5. If the elevator is on a given floor and is going down, then it could be used only to go down. Thus the direction in which the elevator is going must be known at all times and the floor to which it is going. If the elevator is going up, the request could be anywhere from floor 2 to 12. If it is going down, it can be from 12 to 1, with 1 being the default The location of the elevator must be known at all times. The program should provide output regarding the current floor, whether the elevator is going up or down, which floor it is starting from and which floor it is going to, as the following output will show 6. 7. Each time you stop at a floor, you must stay there for 3 seconds (allowing the people to either enter the elevator or leave the elevator). Display this time in a counting format as well as an appropriate message. The elevator must take 2 seconds to move from one floor to another. No need to display this time
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
