944,222 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 9094
  • Java RSS
Oct 17th, 2007
0

cannot find symbol error message

Expand Post »
Here the error i get from the file below

Java Syntax (Toggle Plain Text)
  1.  
  2. F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:1: cannot find symbol
  3. symbol : class Calender
  4. location: package java.util
  5. import java.util.Calender;
  6. ^
  7. F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:22: cannot find symbol
  8. symbol : class DateComponent
  9. location: class FulltimeEmployee
  10. DateComponent dc = new DateComponent(date);
  11. ^
  12. F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:22: cannot find symbol
  13. symbol : class DateComponent
  14. location: class FulltimeEmployee
  15. DateComponent dc = new DateComponent(date);
  16. ^
  17. F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:27: cannot find symbol
  18. symbol : class Calender
  19. location: class FulltimeEmployee
  20. Calender today = Calender.getInstance();
  21. ^
  22. F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:27: cannot find symbol
  23. symbol : variable Calender
  24. location: class FulltimeEmployee
  25. Calender today = Calender.getInstance();
  26. ^
  27. F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:28: cannot find symbol
  28. symbol : variable Calender
  29. location: class FulltimeEmployee
  30. year = today.get(Calender.YEAR);
  31. ^
  32. F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:29: cannot find symbol
  33. symbol : variable Calender
  34. location: class FulltimeEmployee
  35. month = today.get(Calender.MONTH);
  36. ^
  37. F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:30: cannot find symbol
  38. symbol : variable Calender
  39. location: class FulltimeEmployee
  40. day = today.get(Calender.DAY_OF_MONTH);
  41. ^
  42. F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:34: unexpected type
  43. required: variable
  44. found : value
  45. vacationDays = (year - yy) = VACATION_DAYS_PER_YEAR;
  46. ^
  47. F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:38: unexpected type
  48. required: variable
  49. found : value
  50. vacationDays = (year - yy - 1) = VACATION_DAYS_PER_YEAR;
  51. ^
  52. F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:45: return outside method
  53. return salary;
  54. ^
  55. 11 errors
  56.  
  57. Tool completed with exit code 1

here the file which it is referring to to

Java Syntax (Toggle Plain Text)
  1. import java.util.Calender;
  2.  
  3. public class FulltimeEmployee extends Employee
  4. {
  5. protected double salary;
  6. private final int VACATION_DAYS_PER_YEAR = 30;
  7.  
  8. public FulltimeEmployee(String name, String dateHired, double salary)
  9. {
  10. super(name, dateHired);
  11. this.salary = salary;
  12. }
  13.  
  14. public int getVacationDays()
  15. {
  16. int mm, dd, yy;
  17. int month, day, year;
  18. int vacationDays;
  19.  
  20. String date;
  21. date = getDateHired();
  22. DateComponent dc = new DateComponent(date);
  23. mm = dc.getMonth();
  24. dd = dc.getDay();
  25. yy = dc.getYear();
  26.  
  27. Calender today = Calender.getInstance();
  28. year = today.get(Calender.YEAR);
  29. month = today.get(Calender.MONTH);
  30. day = today.get(Calender.DAY_OF_MONTH);
  31.  
  32. if ((month < mm) || ((month == mm) && (day <=dd)))
  33. {
  34. vacationDays = (year - yy) = VACATION_DAYS_PER_YEAR;
  35. }
  36. else
  37. {
  38. vacationDays = (year - yy - 1) = VACATION_DAYS_PER_YEAR;
  39. }
  40. return vacationDays;
  41. }
  42.  
  43. public double getSalary;
  44. {
  45. return salary;
  46. }
  47. }
Last edited by java_starter; Oct 17th, 2007 at 9:24 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
java_starter is offline Offline
15 posts
since Sep 2007
Oct 18th, 2007
0

Re: cannot find symbol error message

You spelt "Calender" wrong. It should be spelt "Calendar"

Also, just glancing at it, your getSalary method is wrong. Should be ...getSalary() not ;...that's just a thought, I'm new to JAVA, but you definitely spelt Calendar wrong.
Last edited by Amurka; Oct 18th, 2007 at 12:54 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Amurka is offline Offline
8 posts
since Oct 2007
Oct 18th, 2007
0

Re: cannot find symbol error message

after fixing the calendar spelling error and after that i am still getting the following error please help...

Java Syntax (Toggle Plain Text)
  1. F:\JAVA\Java Files\lab employee\FullTimeEmployee.java:22: cannot find symbol
  2. symbol : class dateComponent
  3. location: class FullTimeEmployee
  4. dateComponent dc = new DateComponent(date);
  5. ^
  6. F:\JAVA\Java Files\lab employee\FullTimeEmployee.java:22: cannot find symbol
  7. symbol : class DateComponent
  8. location: class FullTimeEmployee
  9. dateComponent dc = new DateComponent(date);
  10. ^
  11. F:\JAVA\Java Files\lab employee\FullTimeEmployee.java:34: unexpected type
  12. required: variable
  13. found : value
  14. vacationDays = (year - yy) = VACATION_DAYS_PER_YEAR;
  15. ^
  16. F:\JAVA\Java Files\lab employee\FullTimeEmployee.java:38: unexpected type
  17. required: variable
  18. found : value
  19. vacationDays = (year - yy - 1) = VACATION_DAYS_PER_YEAR;
  20. ^
  21. F:\JAVA\Java Files\lab employee\FullTimeEmployee.java:43: missing method body, or declare abstract
  22. public double getSalary();
  23. ^
  24. F:\JAVA\Java Files\lab employee\FullTimeEmployee.java:45: return outside method
  25. return salary;
  26. ^
  27. 6 errors
Reputation Points: 10
Solved Threads: 0
Newbie Poster
java_starter is offline Offline
15 posts
since Sep 2007
Oct 18th, 2007
0

Re: cannot find symbol error message

Java Syntax (Toggle Plain Text)
  1. vacationDays = (year - yy) = VACATION_DAYS_PER_YEAR;

That doesn't seem right. I don't know what you want to do so i can't really help, but since "VACATION_DAYS_PER_YEAR" is set to final and set to "30" then you are basically taking the 30 and assigning it to "(year -yy)" and then assigning "(year-yy)" to "vacactionDays" I'm bad at explaining, but can't do that, I think.

When you do more than one equal like that it usually for a 2 things with the same value like:
"int x = y = 4;"
Last edited by Amurka; Oct 18th, 2007 at 1:13 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Amurka is offline Offline
8 posts
since Oct 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC