DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Java (http://www.daniweb.com/forums/forum9.html)
-   -   cannot find symbol error message (http://www.daniweb.com/forums/thread93409.html)

java_starter Oct 17th, 2007 9:23 pm
cannot find symbol error message
 
Here the error i get from the file below


F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:1: cannot find symbol
symbol  : class Calender
location: package java.util
import java.util.Calender;
                ^
F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:22: cannot find symbol
symbol  : class DateComponent
location: class FulltimeEmployee
                DateComponent dc = new DateComponent(date);
                ^
F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:22: cannot find symbol
symbol  : class DateComponent
location: class FulltimeEmployee
                DateComponent dc = new DateComponent(date);
                                      ^
F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:27: cannot find symbol
symbol  : class Calender
location: class FulltimeEmployee
                Calender today = Calender.getInstance();
                ^
F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:27: cannot find symbol
symbol  : variable Calender
location: class FulltimeEmployee
                Calender today = Calender.getInstance();
                                ^
F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:28: cannot find symbol
symbol  : variable Calender
location: class FulltimeEmployee
                year = today.get(Calender.YEAR);
                                ^
F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:29: cannot find symbol
symbol  : variable Calender
location: class FulltimeEmployee
                month = today.get(Calender.MONTH);
                                  ^
F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:30: cannot find symbol
symbol  : variable Calender
location: class FulltimeEmployee
                day = today.get(Calender.DAY_OF_MONTH);
                                ^
F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:34: unexpected type
required: variable
found  : value
                        vacationDays = (year - yy) = VACATION_DAYS_PER_YEAR;
                                            ^
F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:38: unexpected type
required: variable
found  : value
                        vacationDays = (year - yy - 1) = VACATION_DAYS_PER_YEAR;
                                                  ^
F:\JAVA\Java Files\lab employee\FulltimeEmployee.java:45: return outside method
                return salary;
                ^
11 errors

Tool completed with exit code 1

here the file which it is referring to to

import java.util.Calender;

public class FulltimeEmployee extends Employee
{
        protected double salary;
        private final int VACATION_DAYS_PER_YEAR = 30;

        public FulltimeEmployee(String name, String dateHired, double salary)
        {
                super(name, dateHired);
                this.salary = salary;
        }

        public int getVacationDays()
        {
                int mm, dd, yy;
                int month, day, year;
                int vacationDays;

                String date;
                date = getDateHired();
                DateComponent dc = new DateComponent(date);
                mm = dc.getMonth();
                dd = dc.getDay();
                yy = dc.getYear();

                Calender today = Calender.getInstance();
                year = today.get(Calender.YEAR);
                month = today.get(Calender.MONTH);
                day = today.get(Calender.DAY_OF_MONTH);

                if ((month < mm) || ((month == mm) && (day <=dd)))
                {
                        vacationDays = (year - yy) = VACATION_DAYS_PER_YEAR;
                }
                else
                {
                        vacationDays = (year - yy - 1) = VACATION_DAYS_PER_YEAR;
                }
                return vacationDays;
        }

        public double getSalary;
        {
                return salary;
        }
}

Amurka Oct 18th, 2007 12:52 am
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.

java_starter Oct 18th, 2007 1:03 am
Re: cannot find symbol error message
 
after fixing the calendar spelling error and after that i am still getting the following error please help...

F:\JAVA\Java Files\lab employee\FullTimeEmployee.java:22: cannot find symbol
symbol  : class dateComponent
location: class FullTimeEmployee
                dateComponent dc = new DateComponent(date);
                ^
F:\JAVA\Java Files\lab employee\FullTimeEmployee.java:22: cannot find symbol
symbol  : class DateComponent
location: class FullTimeEmployee
                dateComponent dc = new DateComponent(date);
                                      ^
F:\JAVA\Java Files\lab employee\FullTimeEmployee.java:34: unexpected type
required: variable
found  : value
                        vacationDays = (year - yy) = VACATION_DAYS_PER_YEAR;
                                            ^
F:\JAVA\Java Files\lab employee\FullTimeEmployee.java:38: unexpected type
required: variable
found  : value
                        vacationDays = (year - yy - 1) = VACATION_DAYS_PER_YEAR;
                                                  ^
F:\JAVA\Java Files\lab employee\FullTimeEmployee.java:43: missing method body, or declare abstract
        public double getSalary();
                      ^
F:\JAVA\Java Files\lab employee\FullTimeEmployee.java:45: return outside method
                return salary;
                ^
6 errors

Amurka Oct 18th, 2007 1:12 am
Re: cannot find symbol error message
 
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;"


All times are GMT -4. The time now is 9:03 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC