Ok, I'm getting some errors in my SalesEmployee class which extends Employee class. The error has to do with a variable that isnt in the employee class called "managerName". Its in the SalesEmployee class because thats how the teacher wants it. Did I declare it wrong in my SalesEmployee class or what am I doing wrong. Here is my SalesEmployee class and the main class which tests the class.
My errors are: C:\cis163\Project5_2\src\Project5_2.java:62: cannot resolve symbol symbol : constructor Employee (java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,short,double,java.lang.String,Company) location: class Employee Employee anEmployee = new Employee( employeeFName,employeeLName,employeeAddress, ^ C:\cis163\Project5_2\src\Project5_2.java:108: cannot resolve symbol symbol : variable aManagerName location: class Project5_2 aManagerName.setManagerName(managerName); ^ C:\cis163\Project5_2\src\Project5_2.java:130: cannot resolve symbol symbol : variable aManagerName location: class Project5_2 System.out.println( "Managers name; " + aManagerName.getManagerName() ); ^ Thanks
It is as the error said. 1. You are calling constructor which has a managerName, and Empoyee class has no such constructor. You have to call SalesEmployee constructor instead. 2. Again you have the employee variable as Employee object, which does not have setManagerName() method. To solve 1 & 2, you might want to change the Class that you use in the test class, from
For error #3, it is because you never declared aManagerName object. What exactly do you want it to be?
(was moved away by moving the thread while I'm editing...) Could you post some more 'System.out.println'-statements, to prove, this is really an intermediate question? To get a better answer you have to do something: Eliminate comments which aren't useful for intermediate programers:
... and mark the error-line (62)
If anEmployee is a new SalesEmployee, perhaps the constructor works? (and if you bring managerName and company to a consistent order) The next two errors seem to be related to each other:
But if YOU did the work of cutting it, you had chances to find the error on your own. [ April 20, 2004: Message edited by: Stefan Wagner ]
I'm giving up, editing my post. These ubb-thing is somehow buggy. Lines are eliminated from the middle of the postings...
Joined: Apr 08, 2004
Well thanks for the help. I fixed the snippet
and then fixed
After those changes I have more errors, which are C:\cis163\Project5_2\src\Project5_2.java:108: cannot resolve symbol symbol : method setManagerName (java.lang.String) location: class Employee anEmployee.setManagerName(managerName); ^ C:\cis163\Project5_2\src\Project5_2.java:130: cannot resolve symbol symbol : method getManagerName () location: class Employee System.out.println( "Managers name; " + anEmployee.getManagerName() ); ^ I already declared the variable in my SalesEmployee class so I dont understand the error