Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Cant find error, whats wrong here?

Here's the source code I've written from an exercise in a book I have. I keep getting an error message and can't figure out why. I put the error message below the code. By they way, I'm learning at my own pace with many books i have here at home, so I'm not looking for a better way to write this program (using control statements and such) I'm just looking to find out what is wrong with the coding i have here. Thanks for all of your help!

import java.io.*;
import javax.swing.JOptionPane;
import java.text.DecimalFormat;

public class Paycheck
{
static final double FEDERAL = .15;
static final double STATE = .035;
static final double SOCIAL = .0575;
static final double MEDICARE = .0275;
static final double PENSION = .05;
static final double HEALTH = 75.00;

public static void main(String[] args)
{
PrintWriter outFile = new PrintWriter(new FileWriter("a:\\paycheck"));
DecimalFormat twoDigit = new DecimalFormat("0.00");

String name;
String stringGross;
double gross;
double federalDeduction, stateDeduction, socialDeduction, medicareDeduction, pensionDeduction, healthDeduction;
double totalDeductions;
double netPay;

name = JOptionPane.showInputDialog("Enter your name:");
stringGross = JOptionPane.showInputDialog("Enter your gross earnings:");
gross = Double.parseDouble(stringGross);

federalDeduction = gross * FEDERAL;
stateDeduction = gross * STATE;
socialDeduction = gross * SOCIAL;
medicareDeduction = gross * MEDICARE;
pensionDeduction = gross * PENSION;
healthDeduction = gross * HEALTH;
totalDeductions = federalDeduction + stateDeduction + socialDeduction + medicareDeduction + pensionDeduction + healthDeduction;

netPay = gross - totalDeductions;

outFile.printLn(name);
outFile.printLn("Gross Amount: $" + twoDigit.format(gross));
outFile.printLn("Federal Tax: $" + twoDigit.format(federalDeduction));
outFile.printLn("State Tax: $" + twoDigit.format(stateDeduction));
outFile.printLn("Social Security Tax: $" + twoDigit.format(socialDeduction));
outFile.printLn("Medicare/Medicaid Tax: $" + twoDigit.format(medicareDeduction));
outFile.printLn("Pension Plan: $" + twoDigit.format(pensionDeduction));
outFile.printLn("Health Insurance: $" + twoDigit.format(healthDeduction));
outFile.printLn("Net Pay: $" + twoDigit.format(netPay));

outFile.close();
System.exit(0);
}
}

And the error message I keep getting:

Paycheck.java:40: cannot find symbol
symbol : method printLn(java.lang.string)
location : class java.io.PrintWriter
outFile.printLn(name);
^

I get this same error for every printLn statement
Whats wrong?!?!
[3080 byte] By [Neutron] at [2007-11-11 7:32:55]
# 1 Re: Cant find error, whats wrong here?
printLn() isn't the proper method name, its println(). Make the "L" lowercase.
Phaelax at 2007-11-11 22:38:01 >