Java Genesis

Hints for Chapter 6: Methods

Problem 1: hint 2

Here is our code for the method cent2fah:

   public static double cent2fah (double cent) {
	return 9.0/5*cent + 32;
   }

Notice that we need to ensure the division by 5 is floating point, so we express it as 9.0/5.

Now try placing this method in a class Fever and constructing a main method for this class so that when run, the required table of temperatures is displayed in the Transcript window.


Previous Hint | Next Hint