fork download
  1. /**
  2.  * Homework 1
  3.  * Sean Roberts
  4.  * 3/25/2017
  5.  */
  6. public class Homework1 {
  7.  
  8. public static void main(String[] args) {
  9. int EMPLID, ageInMonths;
  10. double quiz1, quiz2, quiz3, average, temperatureInFahrenheit;
  11. Scanner input = new Scanner(System.in);
  12. System.out.print("Enter your Student EMPLID :");
  13. EMPLID = input.nextInt();
  14. if (EMPLID <= 0 || EMPLID > 999999) {
  15. do {
  16. System.out.println("must be between 0-999999");
  17. System.out.print("Enter your Student EMPLID :");
  18. EMPLID = input.nextInt();
  19.  
  20. } while (EMPLID <= 0 || EMPLID > 999999);
  21. }
  22.  
  23. System.out.print("Enter your quiz1 score :");
  24. quiz1 = input.nextDouble();
  25. if (quiz1 <= 0 || quiz1 > 100) {
  26. do {
  27. System.out.println("Score must be between 0-100");
  28. System.out.print("Enter your quiz1 score :");
  29. quiz1 = input.nextDouble();
  30.  
  31. } while (quiz1 <= 0 || quiz1 > 100);
  32. }
  33. System.out.print("Enter your quiz2 score :");
  34. quiz2 = input.nextDouble();
  35. if (quiz2 <= 0 || quiz2 > 100) {
  36. do {
  37. System.out.println("Score must be between 0-100");
  38. System.out.print("Enter your quiz2 score :");
  39. quiz2 = input.nextDouble();
  40.  
  41. } while (quiz2 <= 0 || quiz2 > 100);
  42. }
  43. System.out.print("Enter your quiz3 score :");
  44. quiz3 = input.nextDouble();
  45. if (quiz3 <= 0 || quiz3 > 100) {
  46. do {
  47. System.out.println("Score must be between 0-100");
  48. System.out.print("Enter your quiz3 score :");
  49. quiz3 = input.nextDouble();
  50.  
  51. } while (quiz3 <= 0 || quiz3 > 100);
  52. }
  53. System.out.print("Enter your age :");
  54. age = input.nextInt();
  55. if (age <= 0 || age > 120) {
  56. do {
  57. System.out.println("must be between 0-120");
  58. System.out.print("Enter your age :");
  59. age = input.nextInt();
  60.  
  61. } while (age <= 0 || age > 120);
  62.  
  63. }
  64. System.out.print("Enter the current Temperature in degrees Fahrenheit :");
  65. temperatureInDegrees = input.nextDouble();
  66.  
  67. average = (quiz1 + quiz2 + quiz3) / 3.0;
  68. ageInMonths = (age * 12);
  69. temperatureInDegrees = ((temperatureInFahrenheit - 32) * 5) / 9;
  70.  
  71. System.out.println("***Thank you***");
  72. System.out.println("Student EMPLID: " + EMPLID);
  73. System.out.println("Quiz 1 Score: " + quiz1);
  74. System.out.println("Quiz 2 Score: " + quiz2);
  75. System.out.println("Quiz 3 Score: " + quiz 3);
  76. System.out.println("Average quiz score: " + average);
  77. System.out.println("Age in months: " + ageInMonths);
  78. System.out.println(Age in years: " + age);
  79. System.out.printf("Temperature in Celsius: " + temperatureInDegrees);
  80. System.out.printf("Temperature in Fahrenheit: " + temperatureInFahrenheit);
  81.  
  82. }
  83.  
  84. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:75: error: ')' expected
        System.out.println("Quiz 3 Score: " + quiz 3);
                                                  ^
Main.java:75: error: illegal start of expression
        System.out.println("Quiz 3 Score: " + quiz 3);
                                                    ^
Main.java:78: error: ')' expected
        System.out.println(Age in years: " + age);
                              ^
Main.java:78: error: unclosed string literal
        System.out.println(Age in years: " + age);
                                         ^
4 errors
stdout
Standard output is empty