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

Write Java (Zybook 8.4.1) Using the celsiusToKelvin function as a guide, create

ID: 3579189 • Letter: W

Question

Write Java (Zybook 8.4.1)

Using the celsiusToKelvin function as a guide, create a new function, changing the name to kelvinToCelsius, and modifying the function accordingly.

import java.util.Scanner;

public class TemperatureConversion {
public static double celsiusToKelvin(double valueCelsius) {
double valueKelvin = 0.0;

valueKelvin = valueCelsius + 273.15;

return valueKelvin;
}

/* Your solution goes here */

public static void main (String [] args) {
double valueC = 0.0;
double valueK = 0.0;

valueC = 10.0;
System.out.println(valueC + " C is " + celsiusToKelvin(valueC) + " K");

valueK = 283.15;
System.out.println(valueK + " is " + kelvinToCelsius(valueK) + " C");

return;
}
}

Explanation / Answer

TemperatureConversion.java


import java.util.Scanner;
public class TemperatureConversion {
public static double celsiusToKelvin(double valueCelsius) {
double valueKelvin = 0.0;
valueKelvin = valueCelsius + 273.15;
return valueKelvin;
}
   /* Your solution goes here */
  public static double kelvinToCelsius(double valueKelvin) {
   double valueCelsius = 0.0;
   valueCelsius = valueKelvin - 273.15;
   return valueCelsius;
   }

public static void main (String [] args) {
double valueC = 0.0;
double valueK = 0.0;
valueC = 10.0;
System.out.println(valueC + " C is " + celsiusToKelvin(valueC) + " K");
valueK = 283.15;
System.out.println(valueK + " is " + kelvinToCelsius(valueK) + " C");
return;
}
}

Output:

10.0 C is 283.15 K
283.15 is 10.0 C

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