Question: You are to write a program name elevator.java that simulates one elevator services in a 12-floor building. NOTE There is only one elevator working this

 You are to write a program name elevator.java that simulates one
elevator services in a 12-floor building. NOTE There is only one elevator
working this building. Here are some requirements for the program 1. The

You are to write a program name elevator.java that simulates one elevator services in a 12-floor building. NOTE There is only one elevator working this building. Here are some requirements for the program 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 Array List 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 1t floor and the first request is made from the ArrayList which must be a request to go up 4. From the 1t floor, the elevator can only go in one direction - up. And from the 12 floor the elevator can only go in one direction - down. For the other floors, the elevator can go in either direction i.e. if it is going down when you get on and you want to go up and the down ArrayList is empty, then the elevator could start going up from that floor. The same will be true if the elevator is going up when you get on, and you want to go down and the up ArrayList is empty, then it can start going down from that floor. 5. The direction in which the clevater 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 anywbere from floor 2 to 12. If it is going down, it can be from 11 to I, with 1 being the default

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!