I am having problems with the end of my Java program and no matter what I do, it says that I have an error by reaching the end of file while parsing. What is parsing and how do I fix it?
Here is the last of my psuedocode...
if (name.equalsIgnoreCase("stop"))
// compare values in the string to the literal string "stop"
System.out.printf("\nProgram termination requested.\n");
else {
do { // repeat steps until user enters a rate above 0...
System.out.printf("Please enter %s's hourly rate of pay: $", name);
rate = input.nextDouble();
if (rate <= 0)
System.out.printf("\n *** Hourly rate of pay can only be entered in POSITIVE numbers! Try again!\n");
} while (rate <= 0);
do { // repeat steps until user enters more than 0 hrs...
System.out.printf("Please enter %s's amount of hours worked: ", name);
hours = input.nextInt();
if (hours <= 0)
System.out.printf("\n *** Hours worked can only be entered in POSITIVE numbers! Try again!\n");
} while (hours <=0);
}
Copyright © 2024 VQUIX.COM - All rights reserved.
Answers & Comments
Verified answer
Parsing is the process of the compiler trying to categorize (parse) all the lines of your code. Most likely you are missing a closing } somewhere, perhaps to close the class.
If you are using an ide, have it auto format the file and it will become clear.
No... problem is here: //see it. It will still be initialized inside the do part, //thought double num2; { <----BAD...Take this out //init num2 num2 = (int)(Math.round(Math.random()*3));