Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Name: Dillon Ramesh
- //Date: 02/21/2019
- import java.util.Scanner;
- public class Exercise3 {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //Variables
- String ans = null;
- String ansmc;
- String anstf;
- String ansyn;
- String ansmc2;
- String anstf2;
- //Input
- Scanner input= new Scanner (System.in);
- //Loop
- do
- {
- System.out.println("Welcome to the quiz");
- System.out.println("Question 1: \n What car do I drive?");
- System.out.println("A for Volkswagen, B for Honda, C for Chevrolet");
- ansmc=input.next();
- System.out.println("Question 2:\n My favourite sport is Hockey true of false?");
- anstf=input.next();
- System.out.println("Question 3: \n I have an acer laptop yes or no");
- ansyn=input.next();
- System.out.println("Question 4: \n What is my favourite colour?");
- System.out.println("A for Red, B for Blue, C for Green");
- ansmc2=input.next();
- System.out.println("Question 5: \n Both my parents are accountants true or false?");
- anstf2=input.next();
- if (ansmc.equalsIgnoreCase("A") || anstf.equalsIgnoreCase("T") || ansyn.equalsIgnoreCase("Y") || ansmc2.equalsIgnoreCase("B") || anstf2.equalsIgnoreCase("T"))
- {
- System.out.print("Correct");
- }
- else
- {
- System.out.println("Incorrect");
- }
- System.out.println("\nDo you want to retake the quiz?");
- ans=input.next();
- }while (ans.equalsIgnoreCase("Y"));
- System.out.println("Thanks for taking the quiz");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement