I am working on a program that acts like an elevator. The user should be able to enter a destination floor between 1 and 20. Say the user enters 5. The program output should be:
The doors are closing.
Going up to floor 2.
Going up to floor 3.
Going up to floor 4.
The elevator is on floor 5.
Please enter a new destination floor.
And if the user enters 2, then the output should look like:
The doors are closing.
Going down to floor 2.
Going down to floor 3.
Going down to floor 4.
The elevator is on floor 5.
Please enter a new destination floor.
I need to write a class to use with this program. I have included what I have completed of the class. I need help on writing the loops to control the elevator up and down.
Thanks for the help.
Brian



LinkBack URL
About LinkBacks



Unless of course if we're going down the basement, in which case, that would be accurate, eh?