fork(1) download
  1. import java.util.Scanner;
  2. public class Temperature
  3. {
  4.  
  5. public static double convertFtoC(double F)
  6. {
  7. return (F-32)*5/9;
  8. }
  9.  
  10. public static void main(String[] args)
  11. {
  12. double F; //Stores Farenheit
  13. double C; //Stores Celsius
  14.  
  15. Scanner keyboard = new Scanner(System.in);
  16.  
  17. System.out.print("Enter a temperature in Fahrenheit: "); //Enter in Farenheit
  18. F = keyboard.nextDouble(); //Stores Farenheit
  19.  
  20. System.out.println("The temperature in Celsius is: " + convertFtoC(F)); //Displays Celsius (call convertFtoC(F) where celcuis conversion needed)
  21.  
  22. F = 0;
  23.  
  24. System.out.println("Fahrenheit\t Celsius");
  25. while (F <= 100)
  26.  
  27. {
  28. // Display the F and C in increments of 10.
  29. System.out.println(F + "\t\t" + convertFtoC(F));
  30. // Increment for the next day.
  31. F++;
  32. }
  33.  
  34. }
  35. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:2: error: class Temperature is public, should be declared in a file named Temperature.java
public class Temperature
       ^
1 error
stdout
Standard output is empty