By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,536 Members | 2,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,536 IT Pros & Developers. It's quick & easy.

Employee Class - symbol problem

P: 16
Hi

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

C:\Documents and Settings\Jessica Romero\Desktop\Employee.java:23: cannot find symbol
symbol : method sethourlySalary(double)
location: class Employee
sethourlySalary(hourlyS);
^
C:\Documents and Settings\Jessica Romero\Desktop\Employee.java:24: cannot find symbol
symbol : method setweeklyHours(double)
location: class Employee
setweeklyHours(weeklyH);
^
C:\Documents and Settings\Jessica Romero\Desktop\Employee.java:82: cannot find symbol
symbol : variable weeklyH
location: class Employee
return weeklyH;
^
3 errors

Tool completed with exit code 1

Here is mi code


Expand|Select|Wrap|Line Numbers
  1. //Create by Jessica Romero
  2.  
  3. public class Employee{
  4.  
  5.     private String firstName;
  6.     private String lastName;
  7.     private String middleName;
  8.     private String socialSecurityNumber;
  9.     private String dateBirth;
  10.     private double hourlySalary; //Salary per hours
  11.     private double weeklyHours; //hours worked
  12.  
  13.  
  14.  
  15. public Employee (String first, String last, String middle, String ssn, String dateB, double hourlyS, double weeklyH){
  16.  
  17.     firstName = first;
  18.     lastName = last;
  19.     middleName = middle;
  20.     socialSecurityNumber = ssn;
  21.     dateBirth = dateB;
  22.     sethourlySalary(hourlyS);
  23.     setweeklyHours(weeklyH);
  24. }
  25.  
  26. public void setFirstName(String first){
  27.     firstName = first;
  28. }
  29.  
  30. public String getFirstName(){
  31.     return firstName;
  32.  
  33. }
  34.  
  35. public void setLastName(String last){
  36.     lastName = last;
  37. }
  38. public String getLastName(){
  39.  
  40. return lastName;
  41.  
  42. }
  43.  
  44. public void setMiddleName(String middle){
  45.  
  46.     middleName = middle;
  47. }
  48.  
  49. public String getMiddleName(){
  50.  
  51. return middleName;
  52. }
  53.  
  54.  
  55. public String getSocialSecurityNumber(){
  56.     return socialSecurityNumber;
  57.  
  58. }
  59.  
  60. public String getDateBirth(){
  61.     return dateBirth;
  62. }
  63.  
  64. public void setHourlySalary(double hourlyS){
  65.  
  66.     hourlySalary = ( hourlyS > 0.0 && hourlyS < 1.0 ) ? hourlyS : 0.0;
  67. }
  68.  
  69. public double getHourlySalary(){
  70.  
  71.     return hourlySalary;
  72. }
  73.  
  74. public void setWeeklyHours(double weeklyH){
  75.  
  76.     weeklyHours = ((weeklyH >= 0.0) && ( weeklyH <= 20.0))?
  77.     weeklyH :0.0;
  78. }
  79.  
  80. public double getWeeklyHours(){
  81.     return weeklyH;
  82. }
  83.  
  84.  
  85. public double earnings()
  86. {
  87.     return hourlySalary * weeklyHours;
  88. }
  89.  
  90.  
  91.  
  92. public String toString()
  93. {
  94.  
  95.     return String.format("%s: %s %s \n%s:  %s\n%s: %s  %.2f\n %.2f\n%s: %.2f",
  96.     "Employee", firstName, lastName, middleName,
  97.     "social security number", socialSecurityNumber,
  98.     "Date Birth",dateBirth,
  99.     "Salary", hourlySalary,
  100.     "Weekly Hours" , weeklyHours);
  101. }
  102.  
  103. }
Sep 29 '07 #1
Share this Question
Share on Google+
4 Replies


Ganon11
Expert 2.5K+
P: 3,652
1) Please use [code] tags when posting code.

2) Check your spelling and capitalization of the methods and variables mentioned.
Sep 30 '07 #2

P: 16
My spelling is correct ... I don't see any problem.... please help me
Sep 30 '07 #3

Ganon11
Expert 2.5K+
P: 3,652
Expand|Select|Wrap|Line Numbers
  1. C:\Documents and Settings\Jessica Romero\Desktop\Employee.java:23: cannot find symbol
  2. symbol : method sethourlySalary(double)
  3. location: class Employee
  4. sethourlySalary(hourlyS);
  5. ^
Expand|Select|Wrap|Line Numbers
  1. public void setHourlySalary(double hourlyS)
Expand|Select|Wrap|Line Numbers
  1. C:\Documents and Settings\Jessica Romero\Desktop\Employee.java:24: cannot find symbol
  2. symbol : method setweeklyHours(double)
  3. location: class Employee
  4. setweeklyHours(weeklyH);
  5. ^
Expand|Select|Wrap|Line Numbers
  1. public void setWeeklyHours(double weeklyH)
Expand|Select|Wrap|Line Numbers
  1. C:\Documents and Settings\Jessica Romero\Desktop\Employee.java:82: cannot find symbol
  2. symbol : variable weeklyH
  3. location: class Employee
  4. return weeklyH;
  5. ^
Expand|Select|Wrap|Line Numbers
  1. private double weeklyHours; //hours worked
  2. //...
  3. public double getWeeklyHours(){
  4.     return weeklyH;
  5. }
Are you sure your spelling is correct? Remember, Java is case sensitive, so sethourlyRate is different than setHourlyRate.
Sep 30 '07 #4

P: 16
Thank you, I will change the spelling
Oct 1 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.