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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset