Need Java help CHALLENGE ACTIVITY 8.4.1: Method errors: Copying one function to
ID: 3590527 • Letter: N
Question
Need Java help
CHALLENGE ACTIVITY 8.4.1: Method errors: Copying one function to create another Using the celsiusToKelvin function as a guide, create a new function, changing the name to kelvinToCelsius, and modifying the function accordingly 1 import java.util.Scanner; 1 test 3 public class TemperatureConversion f 4 public static double celsiusToKelvin(double valueCelsius){ passed double valueKelvin = 0.0; valueKelvin = valueCelsius + 273.15; return valueKelvin; 6 All tests passed 10 12 public static void main (String [] args) 13 14 15 16 17 18 19 20 0.0; double valueC- double valueK = 0.0 value = 10.0; System.out.println(valueC Cis "celsiusToKelvin(valueC)K"); valueK = 283.15; System.out.println(valueK +is "+kelvinToCelsius (valuek) "C"); RunExplanation / Answer
Hi please find the below code and execute. Any doubts comment here.
TemparatureConversion.java
public class TemparatureConversion {
public static double celsiusToKelvin(double valueCelcius){
double valueKelvin=0.0;
valueKelvin = valueCelcius+273.15;
return valueKelvin;
}
private static double kelvinToCelsius(double valueK) {
double valueCelsius=0.0;
valueCelsius = valueK - 273.15;
return valueCelsius;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
double valueC=0.0;
double valueK=0.0;
valueC = 10.0;
System.out.println(valueC+" C is "+celsiusToKelvin(valueC)+" K");
valueK = 293.0;
System.out.println(valueC+" is "+kelvinToCelsius(valueK)+" C");
}
}
Check it. Thank you. All the best.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.