You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
534 B
10 lines
534 B
Public class TemperatureConverter {
|
|
public static double
|
|
celsiusToFahrenheit(double celsius) { return celsius * 9.0 / 5.0 + 32; }
|
|
public static double
|
|
fahrenheitToCelsius(double fahrenheit) { return (fahrenheit - 32) * 5.0 / 9.0; }
|
|
public static void main(String[] args) {
|
|
double c = 37.0;
|
|
double f = 98.6;
|
|
System.out.println(c + “ C = “ + celsiusToFahrenheit(c) + “ F”);
|
|
System.out.println(f + “ F = “ + fahrenheitToCelsius(f) + “ C”); }}
|
|
|