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

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.