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:Write a simple Account class containing an instance variable called balance and a property called Balance to provide access to balance. Allow the Account class to be sorted by the generic BubbleSortAscending contained in the Sorter class of Listing 17.13 by letting it implement the IComparable interface. Test your Account class by creating an array of Accounts with different balances and pass this as an argument to the BubbleSortAscending method.
2:Write three classes called Secretary, Director, and Programmer. Each of the classes contains a CalculateSalary method. For simplicity, let each of these methods write “Now calculating the salary for…” followed by the name of the class in which the method resides.

Suppose there ...

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