fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // Example F to C in Java
  13. // This file must be named FahrenheitToCelsius.java
  14. //import java.util.Scanner;
  15. //public class FahrenheitToCelsius {
  16. public static final double LOW_TEMP_F_WARNING=0.;
  17. public static final double HIGH_TEMP_F_WARNING=100.;
  18. public static final int MAX_LOOP=5;
  19. public static void main(String[] args) {
  20. Scanner scanFaren = new Scanner(System.in);
  21. double Farenheit = 0;
  22. double Celsius = 0;
  23. for(int i=0; i<MAX_LOOP; i++){
  24. System.out.print("\nEnter a temperature in Fahrenheit: ");
  25. if(scanFaren.hasNextDouble())
  26. {
  27. Farenheit=scanFaren.nextDouble();
  28. Celsius = ( Farenheit- 32.)*5./9.;
  29. }else{
  30. System.out.println("Data entry error - try again\n");
  31. System.exit(-1); }
  32. System.out.println("The temperature in Celsius is: "+Celsius);
  33.  
  34. // Check for high temperature and issue a warning if necessary
  35. if(Farenheit > HIGH_TEMP_F_WARNING){
  36. System.out.print("Remember to hydrate\n");}
  37. // Check for low temperature and issue a warning if necessary
  38. if(Farenheit < LOW_TEMP_F_WARNING ){
  39. System.out.print("Remember to pack Long underwear\n");}
  40. }
  41. System.exit(-1);
  42. }
  43. }
  44. }
  45. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:16: error: illegal start of expression
    public static final  double  LOW_TEMP_F_WARNING=0.;
    ^
Main.java:16: error: illegal start of expression
    public static final  double  LOW_TEMP_F_WARNING=0.;
           ^
Main.java:16: error: ';' expected
    public static final  double  LOW_TEMP_F_WARNING=0.;
                 ^
Main.java:17: error: illegal start of expression
    public static final  double  HIGH_TEMP_F_WARNING=100.;
    ^
Main.java:17: error: illegal start of expression
    public static final  double  HIGH_TEMP_F_WARNING=100.;
           ^
Main.java:17: error: ';' expected
    public static final  double  HIGH_TEMP_F_WARNING=100.;
                 ^
Main.java:18: error: illegal start of expression
    public static final  int     MAX_LOOP=5;
    ^
Main.java:18: error: illegal start of expression
    public static final  int     MAX_LOOP=5;
           ^
Main.java:18: error: ';' expected
    public static final  int     MAX_LOOP=5;
                 ^
Main.java:19: error: illegal start of expression
    public static void main(String[] args) {
    ^
Main.java:19: error: illegal start of expression
    public static void main(String[] args) {
           ^
Main.java:19: error: ';' expected
    public static void main(String[] args) {
                 ^
Main.java:19: error: '.class' expected
    public static void main(String[] args) {
                                     ^
Main.java:19: error: ';' expected
    public static void main(String[] args) {
                                         ^
Main.java:45: error: class, interface, or enum expected
}
^
15 errors
stdout
Standard output is empty