DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2005

    Can't 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("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));

    And the error message I keep getting:

    Paycheck.java:40: cannot find symbol
    symbol    : method printLn(java.lang.string)
    location   : class java.io.PrintWriter
    I get this same error for every printLn statement
    Whats wrong?!?!

  2. #2
    Join Date
    Mar 2004
    printLn() isn't the proper method name, its println(). Make the "L" lowercase.

Similar Threads

  1. I can't find the mode...?
    By nativejam in forum Java
    Replies: 7
    Last Post: 04-11-2005, 03:02 PM
  2. Find Dialog - Set the "Look In" path.....
    By Crispin Wright in forum VB Classic
    Replies: 2
    Last Post: 08-26-2001, 06:08 PM
  3. Find Executable Application
    By David Chu in forum VB Classic
    Replies: 0
    Last Post: 04-25-2001, 01:48 PM
  4. Replies: 0
    Last Post: 12-25-2000, 04:55 AM
  5. Trying to find info.
    By Robert Gelb in forum VB Classic
    Replies: 0
    Last Post: 04-25-2000, 01:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.