fork download
  1. import java.io.*;
  2.  
  3. public class EnglishToJapaneseQuiz {
  4.  
  5. public int MAX_QUESTION = 5;
  6. public int GOODANSWER = 0;
  7.  
  8. public static void main(String[] args) {
  9. try {
  10. System.out.println("Welcome! This quiz helps you study Japanese in English");
  11. System.out.println("'n' normal");
  12. System.out.println("'h' hard");
  13. System.out.println("'e' expert");
  14. System.out.println("'z' exit");
  15. System.out.println("Please select the level");
  16. String line = reader.readLine();
  17. char c = line.charAt(0);
  18.  
  19. switch (c) {
  20. case 'n':
  21. System.out.println("You selected normal");
  22. for (int i=0; i<MAX_QUESTION; i++) {
  23. int x = (int)(Math.random() * 10) + 1;
  24. switch (x) {
  25. case 1:
  26. System.out.println("School");
  27. String Answer = "学校";
  28. String line = responce.readLine();
  29. If (line.equals(Answer)) {
  30. System.out.println("correct");
  31. GOODANSWER = GOODANSWER + 1;
  32. } else {
  33. System.out.println("incorrect");
  34. }
  35. break;
  36. case 2:
  37. case 3:
  38. case 4:
  39. case 5:
  40. case 6:
  41. case 7:
  42. case 8:
  43. case 9:
  44. case 10:
  45. }
  46. }
  47. break;
  48.  
  49. case 'h':
  50. System.out.println("You selected hard");
  51. break;
  52.  
  53. case 'e':
  54. System.out.println("You selected expert");
  55. break;
  56.  
  57. case 'z':
  58.  
  59. break;
  60.  
  61. default:
  62. System.out.println("you must indicate valid character");
  63. break;
  64. }
  65. } catch (IOException e) {
  66. System.out.println(e);
  67. System.out.println("invalid value");
  68. }
  69. System.out.println("the program was successfully ended");
  70. }
  71. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:31: ';' expected
If (line.equals(Answer)) {
                        ^
Main.java:34: 'else' without 'if'
} else {
  ^
2 errors
stdout
Standard output is empty