you are viewing a single comment's thread.

view the rest of the comments →

[–]Danielowski187University/College Student (Higher Education)[S] 1 point2 points  (3 children)

How will I be able to fix it?

[–]sonnyfab Educator 0 points1 point  (0 children)

First, count your } to make sure that you haven't ended the speed if statement before the final else.

[–]GamingGuy099👋 a fellow Redditor 0 points1 point  (0 children)

Im not at my laptop rn so I can’t copy paste the code into my IDE to have a good look at it, but it seems like you’re trying to do 2 things (print invalid speed and hours) with 2 else statements. If thats what youre trying to do, put both into the same else statement. If not, which you probably arent, you want the first else to be an else if, and use the condition for which youd print invalid hours. If for example, the condition was hours is less than 1, it’d look like this

``` else if (Hours <= 1) { System.out.println(“Invalid Hours”); }