Question
6.4.1: Method errors: Copying one method to create another. Using the celsiusToKelvin method as a guide, create a new method, changing the name to kelvinToCelsius,
6.4.1: Method errors: Copying one method to create another.
Using the celsiusToKelvin method as a guide, create a new method, changing the name to kelvinToCelsius, and modifying the method accordingly.
import java.util.Scanner;
public class TemperatureConversion { public double celsiusToKelvin(double valueCelsius) { double valueKelvin;
valueKelvin = valueCelsius + 273.15;
return valueKelvin; }
/* Your solution goes here */
public static void main (String [] args) { double valueC; double valueK; TemperatureConversion tempConverter = new TemperatureConversion();
valueC = 10.0; System.out.println(valueC + " C is " + tempConverter.celsiusToKelvin(valueC) + " K");
valueK = 283.15; System.out.println(valueK + " is " + tempConverter.kelvinToCelsius(valueK) + " C"); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started