Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //TF2Quiz.java
- package tf2quiz;
- import java.util.Scanner;
- public class TF2Quiz {
- final static Quiz quiz = new Quiz();
- final static Scanner input = new Scanner(System.in);
- public static void main(String[] args) {
- boolean quit;
- quit = false;
- boolean quizTaken;
- quizTaken = false;
- do {
- showMenu(quiz, quizTaken);
- switch(input.nextInt())
- {
- case 1:
- askQuestions();
- break;
- case 2:
- System.out.printf("Your score was %d/10. ", quiz.getScore());
- switch (quiz.getScore())
- {
- case 10:
- System.out.printf("Amazing!\n");
- break;
- case 9:
- case 8:
- case 7:
- System.out.printf("Not bad!\n");
- break;
- case 6:
- case 5:
- System.out.printf("Keep on learning.\n");
- break;
- default:
- System.out.printf("Try again after you've been playing for a while.\n");
- }
- break;
- case 3:
- quit = true;
- break;
- default:
- System.out.println("Invalid choice!");
- }
- } while(!quit);
- }
- private static void showMenu(Quiz quiz, boolean quizTaken)
- {
- System.out.println("===\tTeam Fortress 2 Quiz\t===");
- System.out.printf ("1. %s\n", (quizTaken) ? "Retake the quiz!" : "Take the quiz!");
- System.out.println("2. View your score.");
- System.out.println("3. Quit.");
- }
- private static void clearScreen()
- {
- System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- }
- private static void askQuestions()
- {
- clearScreen();
- quiz.resetScore();
- System.out.println("The quiz begins.");
- System.out.println("Question 1: Out of these four classes, which one is the fastest?");
- quiz.promptChoice("The Sniper", "The Spy", "The Medic", "The Pyro", "3");
- System.out.println("Question 2: What state is Scout from?");
- quiz.promptChoice("Alabama", "Massachusetts", "Pennsylvania", "Michigan", "2");
- System.out.println("Question 3: What is Gabe Newell's favorite class?");
- quiz.promptChoice("The Spy", "The Engineer", "The Soldier", "The Heavy", "1");
- System.out.println("Question 4: In Payload gamemode, how many players are needed to be near the cart to reach the maximum velocity?");
- System.out.println("Obs: Scouts, Soldiers and Demos wielding the Pain Train count as two players.");
- quiz.promptChoice("3", "4", "5", "6", "1");
- System.out.println("Question 5: Which one of these weapons do NOT decrease the wearer's health?");
- quiz.promptChoice("Vitasaw", "Sandman", "Eyelander", "Pain Train", "4");
- System.out.println("Question 6: Which of these weapons is NOT a reskin of a stock weapon?");
- quiz.promptChoice("Holy Mackarel", "Ham Shank", "Original", "Solemn Vow", "4");
- System.out.println("Question 7: Which of these weapons has the most ammo capacity?");
- quiz.promptChoice("Nastacha", "Brass Beast", "Minigun", "Tomislav", "1");
- System.out.println("Question 8: What is the maximum health regeneration rate per second of a Medic?");
- quiz.promptChoice("3", "4", "6", "8", "3");
- System.out.println("Question 9: A Highlander game is composed of how many players?");
- quiz.promptChoice("12", "18", "24", "32", "2");
- System.out.println("Question 10: What is the maximum duration of an ubercharge of the default medigun?");
- quiz.promptChoice("8 seconds", "7 seconds", "9 seconds", "7.5 seconds", "1");
- System.out.println("You have answered all the questions. View your score at the menu!");
- }
- }
- /**
- *
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement