Advertisement
angeloeboy10

Java tp

Jan 22nd, 2021
834
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.36 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3.  
  4. public class quizproject {
  5.     static int score = 0;
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner input = new Scanner(System.in);
  9.         String ans;
  10.  
  11.         String[] questions = {
  12.                 "Who is the new crew member in Strawhat Pirates?",
  13.                 "Who is the right hand of Luffy?",
  14.                 "Who is the 4th Hokage?",
  15.                 "Who is the Captain of the Rocks Pirate?",
  16.                 "How many is the children of Big mom?"
  17.         };
  18.  
  19.         String[] answers = {"a", "c", "a", "a", "b"};
  20.  
  21.         System.out.println(questions[0]);
  22.         System.out.println("\t A.Jinbei");
  23.         System.out.println("\t B.Sabo");
  24.         System.out.println("\t C.Carrot");
  25.         System.out.print("Answer: " );
  26.  
  27.         ans = input.nextLine();
  28.  
  29.         if(ans.equalsIgnoreCase(answers[0])){
  30.             addScore();
  31.         }
  32.  
  33.         System.out.println(questions[1]);
  34.         System.out.println("\t A.Sanji");
  35.         System.out.println("\t B.Usopp");
  36.         System.out.println("\t C.Zoro");
  37.         System.out.print("Answer: " );
  38.  
  39.         ans = input.nextLine();
  40.  
  41.         if(ans.equalsIgnoreCase(answers[1])){
  42.             addScore();
  43.         }
  44.  
  45.         System.out.println(questions[2]);
  46.         System.out.println("\t A.Minato");
  47.         System.out.println("\t B.Tobirama");
  48.         System.out.println("\t C.Sarutobi");
  49.         System.out.print("Answer: " );
  50.  
  51.         ans = input.nextLine();
  52.  
  53.         if(ans.equalsIgnoreCase(answers[2])) {
  54.             addScore();
  55.         }
  56.  
  57.  
  58.         System.out.println(questions[3]);
  59.         System.out.println("\t A.Rocks D. Xebec");
  60.         System.out.println("\t B.Rocks D. Teach");
  61.         System.out.println("\t C.Rocks D. Monkey");
  62.         System.out.print("Answer: " );
  63.  
  64.         ans = input.nextLine();
  65.  
  66.         if(ans.equalsIgnoreCase(answers[3])) {
  67.             addScore();
  68.         }
  69.  
  70.         System.out.println(questions[4]);
  71.         System.out.println("\t A.76");
  72.         System.out.println("\t B.85");
  73.         System.out.println("\t C.88");
  74.         System.out.print("Answer: " );
  75.  
  76.         ans = input.nextLine();
  77.  
  78.         if(ans.equalsIgnoreCase(answers[4])) {
  79.             addScore();
  80.         }
  81.  
  82.  
  83.         System.out.println("Score: " + score);
  84.  
  85.  
  86.     }
  87.  
  88.     public static void addScore(){
  89.         score++;
  90.     }
  91. }
  92.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement