Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- String ready;
- int total = 0;
- System.out.println("Are you ready for a quiz?");
- ready = keyboard.next();
- System.out.println("Okay! Here it goes");
- System.out.println("\nQ1) What is the capital of Nigeria?");
- System.out.println(" 1)Abuya \n 2)Lagos \n 3)Niger ");
- System.out.println(">");
- int choice =keyboard.nextInt();
- if (choice==1) {
- System.out.println("That´s right!");
- total = total + 1;
- } else {
- System.out.println("Sorry, the correct answer is Abuya");
- total = total + 0;
- }
- System.out.println("\nQ2) What´s 9+10 ");
- System.out.println(" 1)21 \n 2)19 \n 3)91 ");
- System.out.println(">");
- int choice2 =keyboard.nextInt();
- if (choice2==2) {
- System.out.println("That´s right!");
- total = total + 1;
- } else {
- System.out.println("Sorry, the correct answer is 19");
- total = total + 0;
- }
- System.out.println("\nQ3) What is the gravity on earth) ");
- System.out.println(" 1)9.81 \n 2)10 \n 3)9 ");
- System.out.println(">");
- int choice3 =keyboard.nextInt();
- if (choice3==1) {
- System.out.println("That´s right!");
- total = total + 1;
- } else {
- System.out.println("Sorry, the correct answer is 9.81ye");
- total = total + 0;
- }
- System.out.println("Overall, you got " + total + " questions correct.");
- System.out.println("Thanks for playing!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement