write a program that will converts a temperature from degrees fahrenhiet to degrees celcius the formula for converting the temperature from degrees fahrenhiet to degrees celcius is c= (5/9)*(F-32)
display both degrees fahrenhiet and degrees celcius.
i dont know what is the problem.
here is my code does not function
import java.util.*;
public class convert {
static Scanner console = new console(Sytem.in);
public static void main(String[] args); {
float celsius;
float fahrenheit;
System.out.println("Enter temperature.");
celsius = console.nextDouble((5/9)*(fahrenheit-32));
System.out.println("fahrenheit + "degrees Fahrenheit" * celsius + "degrees Celsius.");
}
}
Covertion
Started by
genako
, Jun 29 2011 02:28 AM
3 replies to this topic
#1
Posted 29 June 2011 - 02:28 AM
#2
Posted 21 November 2011 - 04:19 AM
import java.util.*;
public class convert
{
static Scanner console = new console(Sytem.in);
public static void main(String[] args);
{
float celsius;
float fahrenheit;
System.out.println("Enter temperature.");
celsius = console.nextDouble((5/9)*(fahrenheit-32));
System.out.println("fahrenheit + "degrees Fahrenheit" * celsius + "degrees Celsius.");
}//end of main
}//end of class
#3
Posted 21 November 2011 - 04:22 AM
Its
not
/type /name = new /type;
Scanner console = new Scanner(System.in);
not
static Scanner console = new console(System.in);
/type /name = new /type;
#4
Posted 19 December 2011 - 09:51 PM
Okay, first off, I'd use double instead of float. Also, you should try this:
System.out.println("Enter temperature in fahrenheit");
fahrenheit = console.nextDouble;
celcius = (celcuis*(5/9))*(fahrenheit-32);
instead of
System.out.println("Enter temperature.");
celsius = console.nextDouble((5/9)*(fahrenheit-32));
also, your s.o.p. line is wrong. It should look like this:
System.out.println("fahrenheit + " degrees Fahrenheit equals to " + celsius + "degrees Celsius.");
Also, I thought degree consersion from fahrenheit to celsius was: multiply by 5 over nine, and then subract 32
Or is my memory bad?
System.out.println("Enter temperature in fahrenheit");
fahrenheit = console.nextDouble;
celcius = (celcuis*(5/9))*(fahrenheit-32);
instead of
System.out.println("Enter temperature.");
celsius = console.nextDouble((5/9)*(fahrenheit-32));
also, your s.o.p. line is wrong. It should look like this:
System.out.println("fahrenheit + " degrees Fahrenheit equals to " + celsius + "degrees Celsius.");
Also, I thought degree consersion from fahrenheit to celsius was: multiply by 5 over nine, and then subract 32
Or is my memory bad?










