Learning C# 2005: Get Started with C# 2.0 and .NET Programming (2nd Edition)

8.6. Exercises

Exercise 8-1 .

Write a program with an overloaded method for doubling the value of the argument. One version of the method should double an int value, and the other version should double a float value. Call both methods to demonstrate that they work.

Exercise 8-2 .

Write a program with one method that takes an int value, and returns both double and triple that value. You'll need to use reference parameters.

Exercise 8-3 .

Modify the program from Exercise 8-2 so that you don't need to initialize the variables that will hold the doubled and tripled values before calling the method.

Категории