DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2005
    Posts
    1

    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!

    Code:
    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:

    Code:
    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?!?!

  2. #2
    Join Date
    Mar 2004
    Posts
    635
    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

Bookmarks

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links