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 Assignment8
  9. {
  10. public static void main(String[]args)
  11. {
  12. System.out.println( "1. US Measurment to Metric" + "\n" + "2. Metric to US Measurement" );
  13. int us_or_metric = Input.getInt ( "Please enter the desired convertion" );
  14. switch ( us_or_metric )
  15. {
  16. case 1:
  17. System.out.println( "\n" + "1. Pound to Kilogram" + "\n" + "2. Ounce to Gram" + "\n" + "3. Foot to Meter" + "\n" + "4. Mile to Kilometer" );
  18. int us_conversions = Input.getInt( "Please enter the desired convertion" );
  19. switch ( us_conversions )
  20. {
  21. case 1:
  22. double a = Input.getDouble( "Please enter amount to be converted" );
  23. double b = 0.4536D;
  24. System.out.println( a + "pound(s) is" + pound( a,b ) + "kilogram(s)" );
  25. break;
  26. case 2:
  27. double c = Input.getDouble ( "Please enter amount to be converted" );
  28. double d = 28.5D;
  29. System.out.println( c + "ounce(s) is" + ounce( c,d ) + "gram(s)" );
  30. break;
  31. case 3:
  32. double e = Input.getDouble ( "Please enter amount to be converted" );
  33. double f = 0.3048D;
  34. System.out.println( e + "feet is" + foot( e,f ) + "meter(s)" );
  35. break;
  36. case 4:
  37. double g = Input.getDouble ( "Please enter amount to be converted" );
  38. double h = 1.61D;
  39. System.out.println( g + "mile(s) is" + mile( g,h ) + "kilometer(s)" );
  40. break;
  41. }
  42. break;
  43. case 2:
  44. System.out.println( "\n" + "1. Kilogram to Pound" + "\n" + "2. Gram to Ounce" + "\n" + "3. Meter to Foot" + "\n" + "4. Kilometer to Mile" );
  45. int metric_conversions = Input.getInt ( "Please enter the desired convertion" );
  46. switch ( us_conversions )
  47. {
  48. case 1:
  49. double i = Input.getDouble( "Please enter amount to be converted" );
  50. double j = 2.2046D;
  51. System.out.println( i + "kilogram(s) is" + kilogram( i,j ) + "pound(s)" );
  52. break;
  53. case 2:
  54. double k = Input.getDouble ( "Please enter amount to be converted" );
  55. double l = 0.0352D;
  56. System.out.println( k + "gram(s) is" + gram( k,l ) + "ounce(s)" );
  57. break;
  58. case 3:
  59. double m = Input.getDouble ( "Please enter amount to be converted" );
  60. double n = 3.2808D;
  61. System.out.println( m + "meter(s) is" + meter( m,n ) + "feet" );
  62. break;
  63. case 4:
  64. double o = Input.getDouble ( "Please enter amount to be converted" );
  65. double p = 0.6213D;
  66. System.out.println( o + "kilometer(s) is" + kilometer( o,p ) + "mile(s)" );
  67. break;
  68. }
  69. break;
  70. }
  71. }
  72.  
  73. public static double pound( double a , double b )
  74. {
  75. return a * b;
  76. }
  77.  
  78.  
  79. public static double ounce( double c , double d )
  80. {
  81. return c * d;
  82. }
  83.  
  84. public static double foot( double e, double f )
  85. {
  86. return e * f;
  87. }
  88.  
  89. public static double mile( double g , double h )
  90. {
  91. return g * h;
  92. }
  93. public static double kilogram( double i , double j )
  94. {
  95. return i * j;
  96. }
  97. public static double gram( double k , double l )
  98. {
  99. return k * l;
  100. }
  101. public static double meter( double m , double n )
  102. {
  103. return m * n;
  104. }
  105. public static double kilometer( double o , double p )
  106. {
  107. return o * p;
  108. }
  109. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:13: error: cannot find symbol
    int us_or_metric = Input.getInt ( "Please enter the desired convertion" );
                       ^
  symbol:   variable Input
  location: class Assignment8
Main.java:18: error: cannot find symbol
            int us_conversions = Input.getInt( "Please enter the desired convertion" );
                                 ^
  symbol:   variable Input
  location: class Assignment8
Main.java:22: error: cannot find symbol
                    double a = Input.getDouble( "Please enter amount to be converted" );
                               ^
  symbol:   variable Input
  location: class Assignment8
Main.java:27: error: cannot find symbol
                    double c = Input.getDouble ( "Please enter amount to be converted" );
                               ^
  symbol:   variable Input
  location: class Assignment8
Main.java:32: error: cannot find symbol
                    double e = Input.getDouble ( "Please enter amount to be converted" );
                               ^
  symbol:   variable Input
  location: class Assignment8
Main.java:37: error: cannot find symbol
                    double g = Input.getDouble ( "Please enter amount to be converted" );
                               ^
  symbol:   variable Input
  location: class Assignment8
Main.java:45: error: cannot find symbol
            int metric_conversions = Input.getInt ( "Please enter the desired convertion" );
                                     ^
  symbol:   variable Input
  location: class Assignment8
Main.java:49: error: cannot find symbol
                    double i = Input.getDouble( "Please enter amount to be converted" );
                               ^
  symbol:   variable Input
  location: class Assignment8
Main.java:54: error: cannot find symbol
                    double k = Input.getDouble ( "Please enter amount to be converted" );
                               ^
  symbol:   variable Input
  location: class Assignment8
Main.java:59: error: cannot find symbol
                    double m = Input.getDouble ( "Please enter amount to be converted" );
                               ^
  symbol:   variable Input
  location: class Assignment8
Main.java:64: error: cannot find symbol
                    double o = Input.getDouble ( "Please enter amount to be converted" );
                               ^
  symbol:   variable Input
  location: class Assignment8
11 errors
stdout
Standard output is empty