a.Writeamethodcalledkelvinsthattakesasinput(thatis,asargument)atemperatureindegreesFahrenheit(oftypedouble)andreturnsthetemperatureindegreesKelvin(alsoadouble).Hereisthem...
a. Write a method called kelvins that takes as input (that is, as argument) a temperature in degrees
Fahrenheit (of type double) and returns the temperature in degrees Kelvin (also a double). Here is the
mathematical formula for conversion:
K = 5(F −32)+273.15
9
b. Write another method called temperaturePrinter that takes as input (i.e. as argument) two doubles
and prints the following message to the screen:
F corresponds to K
where is the temperature in degrees Fahrenheit and is the corresponding temperature
in degrees Kelvin.
c. You should test your methods kelvins and temperaturePrinter in the main method by calling them
with 5 different temperatures in degrees Fahrenheit to be converted to Kelvins. Note: you will have to call
both of your methods for each temperature you pick. Also, try to pick numbers that are easy for you to check,
such as 32 F.
展开