Question: Hello, I'm having trouble figuring out the java code for a question that invovles user input to convert temperature from Celsius to Fahrenheit (and vice-versa).
Hello, I'm having trouble figuring out the java code for a question that invovles user input to convert temperature from Celsius to Fahrenheit (and vice-versa). I've seen the question asked on here before, but the code provided did not work out for me, and I'd like to understand what to do. I'm very new to programming and kind of confused, even after looking over the Oracle presentations and the examples from my book. The directions are "Modify the program and create two methods to convert from Celsius to Fahrenheit and vice versa.
public static double CelsiusToFahrenheit (double Celsius) public static double FahrenheitToCelsius (double Fahrenheit) "

emperatureConversion.java Load default template... 1 import java.util.Scanner; 3 public class TemperatureConversion 4 public static void main(String[] args) f scanner scnr = new Scanner (Systen.in); char convertFrom"C'; FIXME: Declare two variables in double data type to store the input and output temperatures; Assign the value 0.0 Prompt the user to select converting to degree C or degree F 12 13 do System.out.println("Convert from degree C, enter C; Convert from degree F, enter F:" convertFrom-Character.toUpperCase(scnr.next ().charAt (0)); (!((convert F ron 'C') ll (convert F rom 'F'))); while } // FIXME: Complete the following to obt ain user ?nput System.out.print 1n ("Ent er degree ?n " + convert F ron + ": "); - =- 17 21 FIXME: Complete the switch statements To convert to degree C, call the Fahrenheit ToCelsius method To convert to degree F, call the Celsius ToFahrenheit method 23 24 f switch (convertFrom) f case 'C': 26 27 28 break; case 'F' 31 32 break; 34 37 FIXME: Create a method to convert from Celsius to Fahrenheit 39 // FIXHE: Creat e a met hod to convert fron Fahrenheit to Celsius
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
