import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Random;

public class QuizGame {
    private static final Map<String, Map<String, String>> quizQuestions = new HashMap<>();
    
    static {
        Map<String, String> question1 = new HashMap<>();
        question1.put("a", "Paris");
        question1.put("b", "London");
        question1.put("c", "Berlin");
        question1.put("d", "Rome");
        
        Map<String, String> question2 = new HashMap<>();
        question2.put("a", "Mars");
        question2.put("b", "Venus");
        question2.put("c", "Jupiter");
        question2.put("d", "Mercury");
        
        Map<String, String> question3 = new HashMap<>();
        question3.put("a", "Nucleus");
        question3.put("b", "Mitochondria");
        question3.put("c", "Ribosome");
        question3.put("d", "Golgi apparatus");
        
        quizQuestions.put("What is the capital of France?", question1);
        quizQuestions.put("Which planet is known as the Red Planet?", question2);
        quizQuestions.put("What is the powerhouse of the cell?", question3);
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Random random = new Random();
        
        System.out.println("Welcome to the Quiz Game!");
        System.out.println("Let's start the quiz.");
        
        int score = 0;
        int numQuestions = 3; // Change this to set the number of questions
        
        for (int i = 0; i < numQuestions; i++) {
            String randomQuestion = (String)quizQuestions.keySet().toArray()[random.nextInt(quizQuestions.size())];
            System.out.println(randomQuestion);
            
            Map<String, String> choices = quizQuestions.get(randomQuestion);
            for (Map.Entry<String, String> entry : choices.entrySet()) {
                System.out.println(entry.getKey() + ": " + entry.getValue());
            }
            
            System.out.print("Enter your choice: ");
            String userAnswer = scanner.nextLine().toLowerCase();
            
            if (choices.containsKey(userAnswer) && choices.get(userAnswer).equals("Paris")) {
                score++;
                System.out.println("Correct!");
            } else {
                System.out.println("Incorrect!");
            }
        }
        
        System.out.println("You scored " + score + " out of " + numQuestions + ".");
        
        scanner.close();
    }
}
