Advertisement
CamiloCastilla

Untitled

Sep 17th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.81 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Main {
  3.  
  4.     public static void main(String[] args) {
  5.         Scanner keyboard = new Scanner(System.in);
  6.  
  7.         String ready;
  8.         int total = 0;
  9.  
  10.         System.out.println("Are you ready for a quiz?");
  11.         ready = keyboard.next();
  12.  
  13.         System.out.println("Okay! Here it goes");
  14.         System.out.println("\nQ1) What is the capital of Nigeria?");
  15.         System.out.println(" 1)Abuya \n 2)Lagos \n 3)Niger ");
  16.         System.out.println(">");
  17.  
  18.         int choice =keyboard.nextInt();
  19.         if (choice==1) {
  20.             System.out.println("That´s right!");
  21.             total = total + 1;
  22.         } else {
  23.             System.out.println("Sorry, the correct answer is Abuya");
  24.             total = total + 0;
  25.         }
  26.  
  27.         System.out.println("\nQ2) What´s 9+10 ");
  28.         System.out.println(" 1)21 \n 2)19 \n 3)91 ");
  29.         System.out.println(">");
  30.  
  31.         int choice2 =keyboard.nextInt();
  32.         if (choice2==2) {
  33.             System.out.println("That´s right!");
  34.             total = total + 1;
  35.         } else {
  36.             System.out.println("Sorry, the correct answer is 19");
  37.             total = total + 0;
  38.         }
  39.  
  40.             System.out.println("\nQ3) What is the gravity on earth) ");
  41.         System.out.println(" 1)9.81 \n 2)10 \n 3)9 ");
  42.         System.out.println(">");
  43.  
  44.             int choice3 =keyboard.nextInt();
  45.             if (choice3==1) {
  46.                 System.out.println("That´s right!");
  47.                 total = total + 1;
  48.             } else {
  49.                 System.out.println("Sorry, the correct answer is 9.81ye");
  50.                 total = total + 0;
  51.             }
  52.             System.out.println("Overall, you got " + total + " questions correct.");
  53.             System.out.println("Thanks for playing!");
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement