Results 1 to 2 of 2
  1. #1
    yalla is offline Member
    Join Date
    Mar 2008
    Posts
    2
    Rep Power
    0

    Default [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

  2. #2
    yalla is offline Member
    Join Date
    Mar 2008
    Posts
    2
    Rep Power
    0

Similar Threads

  1. [SOLVED] Problem with setVisible(); on LINUX
    By lepetitprince in forum AWT / Swing
    Replies: 9
    Last Post: 11-22-2008, 04:14 PM
  2. [SOLVED] alignment problem
    By nanimtech in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 04-10-2008, 01:23 PM
  3. [SOLVED] Problem with extending classes...
    By Bizmark in forum New To Java
    Replies: 4
    Last Post: 04-07-2008, 11:21 PM
  4. [SOLVED] file i/o problem
    By aytidaalkuhs in forum New To Java
    Replies: 3
    Last Post: 04-06-2008, 06:42 PM
  5. [SOLVED] Actionevent problem
    By Cymro in forum New To Java
    Replies: 3
    Last Post: 04-04-2008, 07:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •