O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required