Computer Science, asked by lightningthunder143, 11 months ago

Write a class that contains the following two methods:
0 public static double celsiusToFahrenheit(double celcius)​

Answers

Answered by FSA30
4

Explanation:

(Conversions between Celsius and Fahrenheit) Write a class that contains the following two methods: /** Convert from Celsius to Fahrenheit */ public static double celsiusToFahrenheit(double celsius) /** Convert from Fahrenheit to Celsius */ public static double fahrenheitToCelsius(double fahrenheit) The formula for the conversion is: fahrenheit …

public class TempConversion {

public static void main(String[] args) {

System.out.printf("%-15s%-15s%5s%-15s%-15s\n", "Celsius", "Fahrenheit", "| ", "Fahrenheit", "Celsius");

System.out.println("----------------------------------------------------------");

double celsius = 40; double farenheit = 120;

for (int i = 1; i <= 10; celsius--, farenheit -= 10, i++) {

System.out.printf("%-15.1f%-15.1f%5s%-15.1f%-15.2f\n", celsius, celsiusToFahrenheit(celsius), "| ", farenheit,

fahrenheitToCelsius(farenheit));

}

}

public static double _____________________(______________) {

return (9.0 / 5.0) * celsius + 32;

}

public static ____________ _______________(_________________) {

return (5.0 / 9) * (fahrenheit - 32);

}

}

Answered by apurvanshu1905
1

Answer:

Correct Program =

public class boatTemperature

{

   public static double celsiusToFahrenheit(double celsius) {

       double f = (9.0 / 5) * celsius + 32;

       return f;

   }

   

   public static double fahrenheitToCelsius(double fahrenheit) {

       double c = (5.0 / 9) * (fahrenheit - 32);

       return c;

   }

   

   public static void main(String args[]) {

       double r = celsiusToFahrenheit(100.5);

       System.out.println("100.5 degree celsius in fahrenheit = " + r);

       r = fahrenheitToCelsius(98.6);

       System.out.println("98.6 degree fahrenheit in celsius = " + r);

   }

}

Similar questions