Need help with Java program
I am getting two errors when I try to compile the following program. Please help...
import java.text.NumberFormat;
import java.util.Scanner;
import java.util.Locale;
public class PayrollProgram {
public static void main(String[] args)
{
Scanner input = new Scanner( System.in );
NumberFormat usFormat =
NumberFormat.getCurrencyInstan();
String fName;
String lName;
double hourlyRate = 0.0;
int hours = 0;
System.out.println("Enter the following info for the employee: ");
System.out.println("First name: ");
fName = input.next();
System.out.println("Last name: ");
lName = input.next();
System.out.println("Hourly rate: ");
hourlyRate = Double.parseDouble(input.next(
System.out.println("Hours worked this week:")
hours = Integer.parseInt(input.next(
System.out.println("Here is the employee's info:")
System.out.println("Name: " + fName + " " + lName);
System.out.println("Weekly Pay: " + usFormat.format(hourlyRate * hours));
}
}
[1104 byte] By [
oricksa] at [2007-11-27 2:03:24]

I am still getting these errors in Netbeans 5.5. did I place the semi-colon in the right spot.
init:
deps-jar:
Compiling 1 source file to C:\Java\bin\PayrollPart2\build\classes
C:\Java\bin\PayrollPart2\src\payrollpart2\Main.java:26: ')' expected
System.out.println("Hours worked this week: ");
C:\Java\bin\PayrollPart2\src\payrollpart2\Main.java:29: ')' expected
System.out.println("Here is the employee's info:");
2 errors
BUILD FAILED (total time: 1 second)
This is crazy. I fixed the braces and now I am getting two new errors.
init:
deps-jar:
Compiling 1 source file to C:\Java\bin\PayrollPart2\build\classes
C:\Java\bin\PayrollPart2\src\payrollpart2\Main.java:6: class PayrollProgram is public, should be declared in a file named PayrollProgram.java
public class PayrollProgram {
C:\Java\bin\PayrollPart2\src\payrollpart2\Main.java:12: cannot find symbol
symbol : method getCurrencyInstan()
location: class java.text.NumberFormat
NumberFormat.getCurrencyInstan();
2 errors
BUILD FAILED (total time: 3 seconds)
> This is crazy. I fixed the braces and now I am
> getting two new errors.
>
> init:
> deps-jar:
> Compiling 1 source file to
> C:\Java\bin\PayrollPart2\build\classes
> C:\Java\bin\PayrollPart2\src\payrollpart2\Main.java:6:
> class PayrollProgram is public, should be declared in
> a file named PayrollProgram.java
> public class PayrollProgram {
> C:\Java\bin\PayrollPart2\src\payrollpart2\Main.java:12
> : cannot find symbol
> symbol : method getCurrencyInstan()
> location: class java.text.NumberFormat
> NumberFormat.getCurrencyInstan();
>
> BUILD FAILED (total time: 3 seconds)
Nothing crazy about it.
What do you think this means:
"cannot find symbol
java.text.NumberFormat.getCurrencyInstan()"
If you can't guess, it means that the method "getCurrencyInstan()" doesn't exist within the NumberFormat class. (getCurrencyInstance()" does, though...)