Employee Class - symbol problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jromero
    New Member
    • Sep 2007
    • 16

    #1

    Employee Class - symbol problem

    Hi

    I am getting this error message ...can anyone help me out?????

    C:\Documents and Settings\Jessic a Romero\Desktop\ Employee.java:2 3: cannot find symbol
    symbol : method sethourlySalary (double)
    location: class Employee
    sethourlySalary (hourlyS);
    ^
    C:\Documents and Settings\Jessic a Romero\Desktop\ Employee.java:2 4: cannot find symbol
    symbol : method setweeklyHours( double)
    location: class Employee
    setweeklyHours( weeklyH);
    ^
    C:\Documents and Settings\Jessic a Romero\Desktop\ Employee.java:8 2: cannot find symbol
    symbol : variable weeklyH
    location: class Employee
    return weeklyH;
    ^
    3 errors

    Tool completed with exit code 1

    Here is mi code


    [CODE=java]//Create by Jessica Romero

    public class Employee{

    private String firstName;
    private String lastName;
    private String middleName;
    private String socialSecurityN umber;
    private String dateBirth;
    private double hourlySalary; //Salary per hours
    private double weeklyHours; //hours worked



    public Employee (String first, String last, String middle, String ssn, String dateB, double hourlyS, double weeklyH){

    firstName = first;
    lastName = last;
    middleName = middle;
    socialSecurityN umber = ssn;
    dateBirth = dateB;
    sethourlySalary (hourlyS);
    setweeklyHours( weeklyH);
    }

    public void setFirstName(St ring first){
    firstName = first;
    }

    public String getFirstName(){
    return firstName;

    }

    public void setLastName(Str ing last){
    lastName = last;
    }
    public String getLastName(){

    return lastName;

    }

    public void setMiddleName(S tring middle){

    middleName = middle;
    }

    public String getMiddleName() {

    return middleName;
    }


    public String getSocialSecuri tyNumber(){
    return socialSecurityN umber;

    }

    public String getDateBirth(){
    return dateBirth;
    }

    public void setHourlySalary (double hourlyS){

    hourlySalary = ( hourlyS > 0.0 && hourlyS < 1.0 ) ? hourlyS : 0.0;
    }

    public double getHourlySalary (){

    return hourlySalary;
    }

    public void setWeeklyHours( double weeklyH){

    weeklyHours = ((weeklyH >= 0.0) && ( weeklyH <= 20.0))?
    weeklyH :0.0;
    }

    public double getWeeklyHours( ){
    return weeklyH;
    }


    public double earnings()
    {
    return hourlySalary * weeklyHours;
    }



    public String toString()
    {

    return String.format(" %s: %s %s \n%s: %s\n%s: %s %.2f\n %.2f\n%s: %.2f",
    "Employee", firstName, lastName, middleName,
    "social security number", socialSecurityN umber,
    "Date Birth",dateBirt h,
    "Salary", hourlySalary,
    "Weekly Hours" , weeklyHours);
    }

    }[/CODE]
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    1) Please use [CODE] tags when posting code.

    2) Check your spelling and capitalization of the methods and variables mentioned.

    Comment

    • Jromero
      New Member
      • Sep 2007
      • 16

      #3
      My spelling is correct ... I don't see any problem.... please help me

      Comment

      • Ganon11
        Recognized Expert Specialist
        • Oct 2006
        • 3651

        #4
        Code:
        C:\Documents and Settings\Jessica Romero\Desktop\Employee.java:23: cannot find symbol
        symbol : method sethourlySalary(double)
        location: class Employee
        sethourlySalary(hourlyS);
        ^
        [code=java]public void setHourlySalary (double hourlyS)[/code]

        [code=java]C:\Documents and Settings\Jessic a Romero\Desktop\ Employee.java:2 4: cannot find symbol
        symbol : method setweeklyHours( double)
        location: class Employee
        setweeklyHours( weeklyH);
        ^[/code]

        [code=java]public void setWeeklyHours( double weeklyH)[/code]

        Code:
        C:\Documents and Settings\Jessica Romero\Desktop\Employee.java:82: cannot find symbol
        symbol : variable weeklyH
        location: class Employee
        return weeklyH;
        ^
        [code=java]private double weeklyHours; //hours worked
        //...
        public double getWeeklyHours( ){
        return weeklyH;
        }[/code]

        Are you sure your spelling is correct? Remember, Java is case sensitive, so sethourlyRate is different than setHourlyRate.

        Comment

        • Jromero
          New Member
          • Sep 2007
          • 16

          #5
          Thank you, I will change the spelling

          Comment

          Working...