Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a class that contains the following two methods: /** Converts from Celsius

ID: 3630860 • Letter: W

Question

Write a class that contains the following two methods:

/** Converts from Celsius to Fahrenheit */
public static double celsiusToFahrenheit(double celsius)

/** Converts from Fahrenheit to Celsius */
public static double fahrenheitToCelsius(double fahrenheit)

The formula for the conversion is:

fahrenheit = (9.0 / 5) * celsius + 32

Write a test program that invokes these methods to display the following tables:
Celsius Fahrenheit Fahrenheit Celsius
40.0 104.0 120.0 48.89
39.0 102.2 110.0 43.33
...
32.0 89.6 40.0 4.44
31.0 87.8 30.0 -1.11

Explanation / Answer

class test
{


public static double celsiusToFahrenheit(double c)
{
return (9.0/5.0)*c + 32;
}
public static void main(String[] args)
{
System.out.println("Celsius Fahrenheit ");
for(double i=40; i>=31.0; i--)
System.out.println(i + " " + celsiusToFahrenheit(i));

}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote