You’re designing the software that simulates elevators in a building. Design a set of objects that will manage elevator movement and interaction between the elevators. The elevator simulation should support these features:
- Initialize the elevator simulation with the desired number of elevators, and the desired number of floors. Assume ground/min of 1.
- Each elevator will report as is moves from floor to floor.
- Each elevator will report when it opens or closes its doors.
- An elevator cannot proceed above the top floor.
- An elevator cannot proceed below the ground floor (assume 1 as the min)
- An elevator request can be made at any floor, to go to any other floor.
- When an elevator request is made, the unoccupied elevator closest to it will answer the call, unless an occupied elevator is moving and will pass that floor on its way. The exception is that if an unoccupied elevator is already stopped at that floor, then it will always have the highest priority answering that call.
- The elevator should keep track of how many trips it has made, and how many floors it has passed. The elevator should go into maintenance mode after 100 trips, and stop functioning until serviced, therefore not be available for elevator calls. Some things to think about in this design:
- Should you take an approach using an elevator controller, or have the elevators communicate amongst themselves to find an optimal solution?
- How will your solution scale up and down, from 1 elevator, to a reasonably large number, like 10? Rules of the Challenge:
- The goal of this is to design classes and their interactions. It is primarily a design exercise, not strictly a coding exercise. So if you run out of time, stub the methods and comment on how they should work.
- If you run out of time, focus on the features in the order they are listed as priority order
- Be prepared to talk about and defend your design.
- The code does not have to run! We’ll just assume that the time will exist to work out the bugs and make it actually run. So, pretend it will run, but don’t worry about actually making it run.