Need help with java code: First I need to ask the user to select one option: To
ID: 3552881 • Letter: N
Question
Need help with java code:
First I need to ask the user to select one option: To Celsius, To Fahrenheit, Cancel then -
Temperature converter - have to ask user to enter start temp and end temp then convert it from fahrenheit to celsius and vice versa - using the web service function (URL: http://www.w3schools.com/webservices/tempconvert.asmx?WSDL. I have to display both temps and convert using 2 decimal points. I need to validate Start < End. I then need to display the results using two columns one for F(fahrenheit) and one for C(celsius) using printf to show results.
Any help anyone can give me would be greatly appreciated!
Explanation / Answer
import java.util.Scanner;
public class CelciusToFahrenheit {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
//prompt the use for input
System.out.print("Enter a degree in celcius: ");
double celcius = input.nextDouble();
//calculate
double fahrenheit = (9/5) * celcius + 32; //Converting celcius to fahrenheit
System.out.println(celcius + " Celcius is " + fahrenheit + " Fahrenheit ");
}
}