Home Segments Top Top Previous Next

145: Practice

Write a method, named convert, that converts Celsius temperature to Fahrenheit, by transforming an integer argument into twice that integer plus 30.

Next, arrange for your method to display the result every time that it is called.

Next, amend your method such that it performs temperature conversion only once.

Finally, improve your method by having it add 40 to the argument, multiply by 9/5, and subtract 40.

For each change, comment on the corresponding benefit provided by method abstraction.