|
-
July 20th, 2010, 03:44 PM
#1
Easy answer new to Java. "reached end of file while parsing"
I am very new to Java and need to complete this for some homework. The File runs just will not compile because of "week3day5.java:40: reached end of file while parsing"
Here is the code:
Code:
package whalenpaymachine;
//File: week3day5.java
import java.text.NumberFormat;
import java.util.Scanner;
public class week3day5 {
public static void main(String[] args) {
System.out.println("\nEmployee Payment Calculator\n");
// Input Section
Scanner in = new Scanner(System.in);
String name;
double rate;
double hours;
// Employee Name
do {
//needed for scanner class
Scanner kb = new Scanner(System.in);
// get users string
System.out.print("Enter the employee name: ");
empName = kb.nextLine();
if ("stop".equalsIgnoreCase(empName)) {
// Exit the loop because the user wants to quit
break;
}
// Employee hourly rate:
System.out.print("Enter the hourly rate: ");
rate = Double.parseDouble(in.nextLine());
// Employee hours worked:
System.out.print("Enter the hours worked:");
hours = Double.parseDouble(in.nextLine());
// Output Section
System.out.println("\nEmployee: " + name);
NumberFormat nf = NumberFormat.getCurrencyInstance();
System.out.println(
"\nEarned a weekly Pay of: " + nf.format(rate * hours));
Error message:
"Compiling 1 source file to C:\Users\Daboss\Desktop\IT 215 Java\Compiled\Whalen Pay Machine\build\classes
C:\Users\Daboss\Desktop\IT 215 Java\Compiled\Whalen Pay Machine\src\whalenpaymachine\week3day5.java:40: reached end of file while parsing
"\nEarned a weekly Pay of: " + nf.format(rate * hours));
C:\Users\Daboss\Desktop\IT 215 Java\Compiled\Whalen Pay Machine\src\whalenpaymachine\week3day5.java:41: reached end of file while parsing"
Any help would be appreciated and an explanation so i could learn from my mistakes. Thank you very much!
I do understand I need to add } somewhere I just do not understand where or why!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|