Welcome to Dream.In.Code
Getting Java Help is Easy!

Join 105,413 Java Programmers for FREE! Ask your question and get quick answers from experts. There are 1,830 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



External Methods

 
Reply to this topicStart new topic

External Methods, Compiling Errors

JWD
post 2 Jul, 2008 - 11:49 AM
Post #1


New D.I.C Head

*
Joined: 13 Jun, 2008
Posts: 24


My Contributions


Hi there, having trouble getting this program to compile.

CODE


import java.io.*;

public class Employee
{
    //declare variables
    String FirstName;
    String LastName;
    String Position;
    float Rate;
    float Hours;

    public Employee(String f, l, p float r, h)
    {
        //assigning identifiers with variables
        FirsName = f;
        LastName = l;
        Position = p;
        Rate = r;
        Hours = h;
    }
    public Employee(String f,l,p)
    {
        //assign
        FirstName = f;
        LastName = l;
        Position = p;
    }
    public String getFirstName()
    {
        return FirstName;
    }
    public String getLastName()
    {
        return LastName;
    }
    public String getPosition()
    {
        return Position;
    }
    public float getRate()
    {
        return Rate;
    }
    public float getHours()
    {
        return Hours;
    }
}




Compiling Errors:

C:\Users\Patricia\Documents\Java Applications\Chapter05\Employee.java:20: <identifier> expected
public Employee(String f, l, p float r, h)
^
C:\Users\Patricia\Documents\Java Applications\Chapter05\Employee.java:55: ')' expected
}
^
C:\Users\Patricia\Documents\Java Applications\Chapter05\Employee.java:20: cannot resolve symbol
symbol : class l
location: class Employee
public Employee(String f, l, p float r, h)
^
C:\Users\Patricia\Documents\Java Applications\Chapter05\Employee.java:20: missing method body, or declare abstract
public Employee(String f, l, p float r, h)
^
4 errors

Tool completed with exit code 1
User is offlineProfile CardPM

Go to the top of the page


pbl
post 2 Jul, 2008 - 03:42 PM
Post #2


D.I.C Lover

Group Icon
Joined: 6 Mar, 2008
Posts: 1,839



Thanked 104 times

Dream Kudos: 75
My Contributions


CODE

public Employee(String f, l, p float r, h)
and
public Employee(String f,l,p)


should be

CODE

public Employee(String f, String l, String p,  float r,  float h)
and
public Employee(String f, String l, String p)


Happy coding

User is offlineProfile CardPM

Go to the top of the page

JWD
post 2 Jul, 2008 - 10:31 PM
Post #3


New D.I.C Head

*
Joined: 13 Jun, 2008
Posts: 24


My Contributions


Ahhh... yes!! Thank you!!!
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/20/08 05:48AM

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month