MrDoyle

A Little Quiz

Sep 18th, 2020
903
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner input = new Scanner(System.in);
  7.         System.out.print("Are you ready for a quiz? (Y/N) ");
  8.         char begin = input.next().charAt(0);
  9.  
  10.         int score = 0;
  11.  
  12.         if (begin == 'Y' || begin =='y'){
  13.             System.out.println("OK, here it comes.");
  14.             System.out.println("\nQ1 What is the most coolest subject to take at DP?");
  15.             System.out.println("\t\t1) Design");
  16.             System.out.println("\t\t2) Computer Science");
  17.             System.out.println("\t\t3) What is DP?");
  18.  
  19.             System.out.print("\n> ");
  20.             int question1 = input.nextInt();
  21.             System.out.println();
  22.  
  23.             if(question1 == 2){
  24.                 System.out.println("That is right!");
  25.                 score ++;
  26.             } else{
  27.                 System.out.println("Incorrect");
  28.             }
  29.  
  30.             System.out.println("\nQ2 If Mr Doyle was a cat, what colour would the grass be?");
  31.             System.out.println("\t\t1) Seven");
  32.             System.out.println("\t\t2) Green");
  33.             System.out.println("\t\t3) Dog");
  34.  
  35.             System.out.print("\n> ");
  36.             int question2 = input.nextInt();
  37.             System.out.println();
  38.  
  39.             if(question2 == 2){
  40.                 System.out.println("That is right!");
  41.                 score ++;
  42.             } else{
  43.                 System.out.println("Incorrect");
  44.             }
  45.  
  46.             System.out.println("\nQ3 Can you elbow?");
  47.             System.out.println("\t\t1) Yes");
  48.             System.out.println("\t\t2) No");
  49.  
  50.  
  51.             System.out.print("\n> ");
  52.             int question3 = input.nextInt();
  53.             System.out.println();
  54.  
  55.             if(question3 == 1){
  56.                 System.out.println("Haha you just tried to lick your elbow (and you are incorrect)");
  57.             } else{
  58.                 System.out.println("Correct it is not possible to lick your elbow");
  59.                 score ++;
  60.             }
  61.  
  62.             System.out.println("\nOverall you got " + score + " out of 3 correct.");
  63.             System.out.println("Thanks for playing.");
  64.  
  65.         }else{
  66.             System.out.println("Ok then! Don't take my super awesome quiz, see if I care.");
  67.         }
  68.     }
  69. }
RAW Paste Data