We are going to develop an algorithm and implement in C++ to simulate a single elevator in a 10-story building

We are going to develop an algorithm and implement in C++ to simulate a single elevator in a 10-story building.  There will be some simplifyingassumptions that will make this a bit less complex than a real-worldimplementation.  The number of floors is not important, nor is the numberof people getting on or getting off the elevator. The following rules apply to movement of the elevator:

  1. By default, the elevator will always begin to operate from the 1st floor.
  2. The algorithm needs to support the 2 separate directions of up and down.
  3. The algorithm needs to support the 2 separate requirements of “get on” and “get off”.
  4. Wherever the elevator happens to be, it always continues in the same direction, unless there are no passengers and no people waiting for the elevator with “get on” requests.
  5. When the elevator stops moving in one direction, it checks to see if there are additional “get on” requests.  The elevator does not move again until it receives a request to move.
  6. Once the elevator starts to move, there can be no “get on” requests until the elevator has stopped and has no more pickups or drop-offs in the same direction.  In other words, the elevator does not move in the opposite direction until you receive a request to move.

The approach to simulating the elevator is as follows:

find the cost of your paper