Advertisement
michelksu

Untitled

Jun 9th, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.33 KB | None | 0 0
  1. //TF2Quiz.java
  2.  
  3. package tf2quiz;
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class TF2Quiz {
  8.  
  9. final static Quiz quiz = new Quiz();
  10. final static Scanner input = new Scanner(System.in);
  11.  
  12. public static void main(String[] args) {
  13.  
  14. boolean quit;
  15. quit = false;
  16. boolean quizTaken;
  17. quizTaken = false;
  18.  
  19. do {
  20. showMenu(quiz, quizTaken);
  21. switch(input.nextInt())
  22. {
  23. case 1:
  24. askQuestions();
  25. break;
  26. case 2:
  27. System.out.printf("Your score was %d/10. ", quiz.getScore());
  28. switch (quiz.getScore())
  29. {
  30. case 10:
  31. System.out.printf("Amazing!\n");
  32. break;
  33. case 9:
  34. case 8:
  35. case 7:
  36. System.out.printf("Not bad!\n");
  37. break;
  38. case 6:
  39. case 5:
  40. System.out.printf("Keep on learning.\n");
  41. break;
  42. default:
  43. System.out.printf("Try again after you've been playing for a while.\n");
  44. }
  45. break;
  46. case 3:
  47. quit = true;
  48. break;
  49. default:
  50. System.out.println("Invalid choice!");
  51. }
  52. } while(!quit);
  53. }
  54.  
  55. private static void showMenu(Quiz quiz, boolean quizTaken)
  56. {
  57. System.out.println("===\tTeam Fortress 2 Quiz\t===");
  58. System.out.printf ("1. %s\n", (quizTaken) ? "Retake the quiz!" : "Take the quiz!");
  59. System.out.println("2. View your score.");
  60. System.out.println("3. Quit.");
  61. }
  62.  
  63. private static void clearScreen()
  64. {
  65. System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  66. }
  67.  
  68. private static void askQuestions()
  69. {
  70. clearScreen();
  71. quiz.resetScore();
  72. System.out.println("The quiz begins.");
  73.  
  74. System.out.println("Question 1: Out of these four classes, which one is the fastest?");
  75. quiz.promptChoice("The Sniper", "The Spy", "The Medic", "The Pyro", "3");
  76.  
  77. System.out.println("Question 2: What state is Scout from?");
  78. quiz.promptChoice("Alabama", "Massachusetts", "Pennsylvania", "Michigan", "2");
  79.  
  80. System.out.println("Question 3: What is Gabe Newell's favorite class?");
  81. quiz.promptChoice("The Spy", "The Engineer", "The Soldier", "The Heavy", "1");
  82.  
  83. System.out.println("Question 4: In Payload gamemode, how many players are needed to be near the cart to reach the maximum velocity?");
  84. System.out.println("Obs: Scouts, Soldiers and Demos wielding the Pain Train count as two players.");
  85. quiz.promptChoice("3", "4", "5", "6", "1");
  86.  
  87. System.out.println("Question 5: Which one of these weapons do NOT decrease the wearer's health?");
  88. quiz.promptChoice("Vitasaw", "Sandman", "Eyelander", "Pain Train", "4");
  89.  
  90. System.out.println("Question 6: Which of these weapons is NOT a reskin of a stock weapon?");
  91. quiz.promptChoice("Holy Mackarel", "Ham Shank", "Original", "Solemn Vow", "4");
  92.  
  93. System.out.println("Question 7: Which of these weapons has the most ammo capacity?");
  94. quiz.promptChoice("Nastacha", "Brass Beast", "Minigun", "Tomislav", "1");
  95.  
  96. System.out.println("Question 8: What is the maximum health regeneration rate per second of a Medic?");
  97. quiz.promptChoice("3", "4", "6", "8", "3");
  98.  
  99. System.out.println("Question 9: A Highlander game is composed of how many players?");
  100. quiz.promptChoice("12", "18", "24", "32", "2");
  101.  
  102. System.out.println("Question 10: What is the maximum duration of an ubercharge of the default medigun?");
  103. quiz.promptChoice("8 seconds", "7 seconds", "9 seconds", "7.5 seconds", "1");
  104.  
  105. System.out.println("You have answered all the questions. View your score at the menu!");
  106. }
  107. }
  108.  
  109. /**
  110. *
  111.  
  112.  
  113. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement