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

1:Expand the Bicycle class of Listing 14.2 to contain an instance variable called age that represents the age of a Bicycle. Write a property that allows users of the Bicycle class to set and get the age instance variable. Include code that prevents the age instance variable from being assigned a negative value or a value greater than 200. Equip the Bicycle class with an instance variable called numberOfAgeAccesses to represent the number of times the age instance variable has been accessed. Include a property to access numberOfAgeAccesses. Should this latter property contain both a set and a get statement block?
2:Write a class called Rainfall containing a one-dimensional array with 12 elements representing monthly rainfall ...

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