Hello, I'm new to Java and working on a Nested Statements section of a beginner's Java course. Please help me identify the problem in my code as I have been through it multiple times and can't figure it out. Thanks in advance.
The error message is: FinishLine.java:63: error: reached end of file while parsing } ^ 1 error
This is my code
import java.util.Scanner; /**************** * Alex * FinishLine.java * 04/09/2023 * *************/ public class FinishLine { public static void main(String[] args) { //Variables int speed = 0; int min = 0; int max = 10; //Scanner Scanner input = new Scanner(System.in); //Ask for user input System.out.println("Enter an integer between 0 and 10 for the speed of the car!"); //Read in input //Random number int pressure = ((int) (Math.random() * ((max - min) + 1))) + min; pressure = 1; /**************************************************** * Compare speed to engine pressure which is a random number * if speed is equal to pressure then print out "Game over!" * else if speed is NOT equal to the pressure ask for new number * If the speed isn't equal to the pressure 3 times then Derrik crosses the finish line. ****************************************************/ if(speed == pressure) { System.out.println("Game Over!"); System.out.println("Engine pressure " + pressure); } else if(speed != pressure) { //Ask for user input for 2nd time System.out.println("Almost there, enter another integer between 0 and 10 for the speed of the car!"); //Read in input for 2nd time if(speed == pressure) { System.out.println("Game Over!"); System.out.println("Engine pressure " + pressure); } else { //Ask for user input for 3rd time System.out.println("Get across that finish line! Enter an integer between 0 and 10 for the speed of the car!"); speed = input.nextInt(); System.out.println("Speed " + speed); pressure = 0; //add nested if statement below if(speed == pressure) { System.out.println("Game Over"); System.out.println("Engine pressure " + pressure); } else { System.out.println("Congrats! Derrick made it across the finsh line!"); System.out.println("Engine pressure " + pressure); }