I am getting the error, cannot find symbol- Constructor employee (blahblahblah)

heres the employee class it compiles fine....

public class Employee extends Person
{
private double salary;
private int emplId;
private String emplType;
private String emplTypeDescr;
private String firstName;
private String lastName;
public Employee(String firstName, String lastName, double salary, int emplId, String emplType, String emplTypeDescr)
{
super(firstName, lastName);
this.salary = salary;
this.emplId = emplId;
this.emplType = emplType;
this.emplTypeDescr = emplTypeDescr;


}
public int getEmpId() { return emplId; }
public String getEmplType() { return emplType; }
public String getEmplTypeDescr() { return emplTypeDescr; }

public void setEmplID(int emplId) { this.emplId = emplId; }
public void setEmplType(String emplType) { this.emplType = emplType; }
private void setEmplTypeDescr(String emplTypeDescr) { this.emplTypeDescr = emplTypeDescr; }

}


Manager.java is the problem its not compiling...


public class Manager extends Employee
{

private int emplId;
private String emplType;
private String emplTypeDescr;
private String firstName;
private String lastName;

public Manager(String firstName, String lastName, double salary, int emplId, String emplType, String emplTypeDescr)
{
super(firstName, lastName);
this.salary = salary;
this.emplId = emplId;
this.emplType = emplType;
this.emplTypeDescr = emplTypeDescr;


}

}

green area is the error....

I know this problem has already been solved but i dont understand how to fix it? Can anyone help me?

You haven't defined a constructor for the Employee class that takes two strings, which is what your Manager class is trying to call.

You need to define that constructor.

You haven't defined a constructor for the Employee class that takes two strings, which is what your Manager class is trying to call.

You need to define that constructor.

How do i do that? Sorry i am kind of new at this

Heres person.java


public class Person
{
String firstName;
String lastName;
public Person(String firstName, String lastName)
{
this.firstName = firstName;
this.lastName = lastName;
}
public String concatName() { return lastName + ", " + firstName; }
}


um... is that the same thing as the green highlighted portion here?

No, it's this part

public Person(String firstName, String lastName)
{
   this.firstName = firstName;
   this.lastName = lastName;
}

That is the constructor that is called with the super(firstName, lastName); call in your Employee class. You need to add a constructor like that to Employee, so the super(firstName, lastName); call in your Manager class can access it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.