View Single Post
  #1 (permalink)  
Old 03-30-2008, 06:27 AM
yalla yalla is offline
Member
 
Join Date: Mar 2008
Posts: 2
yalla is on a distinguished road
[SOLVED] Problem with code - inheritence
Hi, Newbie here, and am getting the following error in eclipse:
'Supervisor cannot be resolved to a type' .
I don't get why I am getting this error. Thanks for your help.


public class EnterEmployee {
public static void main(String[] args) {
Supervisor s = new Supervisor("title","naperville");
}
}

--------
public class Supervisor extends Employee1 {
public String title;
public String office;

public Supervisor() {
}

public Supervisor(String title, String office) {
this.title = title;
this.office = office;
}


public String getTitle() {
return title;
}

public String getOffice() {
return office;
}

public void setTitle (String title) {
this.title = title;
}

public void setOffice (String office) {
this.office = office;
}

}
--------
public class Employee1 {
public String firstName;
public String lastName;
public String empID;
public String phoneNumber;
public Double salary;
public String empAddress;

// Constructor #1
public Employee1() {
}


// Constructor #2
public Employee1 (String fName, String lName, String ID,double sal,String address,String Phone) {
setFirstName(fName);
setLastName(lName);
setEmpID(ID);
setSalary(sal);
setAddress(address);
setPhone (Phone);
}



public void setFirstName (String fn) {
firstName = fn;
}

public void setLastName (String ln) {
lastName = ln;
}

public void setEmpID (String eid) {
empID = eid;
}

public void setPhone (String ph) {
phoneNumber = ph;
}

public void setSalary (double sal) {
salary = sal;
}

public void setAddress (String empAdd) {
empAddress = empAdd;
}


//Gets first name
public String getFirstName() {
return firstName;
}
//Gets Last name
public String getLastName() {
return lastName;
}
//Gets Employee1 id
public String getEmpID() {
return empID;
}
//Gets hire date
public String getPhoneNumber() {
return phoneNumber;
}

//Gets salary
public Double getSalary() {
return salary;
}
//Gets title
public String getAddress () {
return empAddress;
}
} // close the class
Reply With Quote
Sponsored Links