Programming Exercises
Enable the program in Listing 5.1 to exhibit the following functionality by changing its source code:
1 | Print “The simulation has commenced” on the command console right after the program is started. |
2 | Print “The simulation has ended” as the last thing just before the program is terminated. |
3 | Instead of merely choosing floors between 1 and 30, the Person class chooses floors between 0 and 50. |
4 | On its first ride, Elevator starts at floor number 0 instead of floor number 1. |
5 | The Elevator object does 10 journeys instead of the 5 it is doing now. |
6 | Elevator is currently counting the total floors traveled with the totalFloorsTraveled variable. Declare an instance variable inside the Elevator class that keeps track of the number ... |
Get C# Primer Plus now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.