I'm currently a senior high school student and I'm doing a short quiz game as a project. And I was wondering if you can add multiple questions. Here Is the code
import java.util.Scanner;
import java.util.Random;
public class Quiz
{
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
Random r = new Random();
int lives = 3;
String answers;
while (lives > 0)
{
System.out.println("Question Goes Here: ");
answers = s.nextLine();
if (answers.equalsIgnoreCase("Answer"))
{
System.out.println("Correct! Please press ENTER to continue");
s.nextLine();
}
//TO-DO IF THE ANSWER IS WRONG
else
{
--lives;
System.out.println("You have " + lives + " lives left");
}
}
//TO-DO IF "LIVES" IS EQUAL TO 0
if (lives == 0)
{
System.out.println("Game Over");
}
}