Can someone please HELP???

public class Person {
	
  private String name;
  private String address;
  private String phoneNumber;
  private String email;
  
  public Person(){
	}
  public Person(String name, String address, String phoneNumber,String email) {
  	this.name =name;
  	this.address=address;
  	this.phoneNumber=phoneNumber;
  	this.email=email;
  }
  public String toString() {
    return "Person "+ this.getName();
  }
  public String getName(){							
  	return name;
  }
}

class Student extends Person {
	
  private static int FRESHMAN = 1;					
  private static int SOPHOMORE = 2;
  private static int JUNIOR = 3;
  private static int SENIOR = 4;

  private int status;
  
  public Student(){
  }
  public Student(int status){
  	this.status=status;
  }
  public Student(String name,String address,String phone,String email,int status){   
  	super(name,address,phone,email);												 
  	this.status=status;
  }
  public String toString() {
    return "Student "+ this.getName();
  }
}

class Employee extends Person {
  private String office;
  private int salary;
  private MyDate dateHired;
  
  public Employee () {
  }
  public Employee(String office, int salary){
  	this.office=office;
  	this.salary=salary;
  	
  }
  public Employee(String name, String address, String phone, String email, String office, int salary){       	
  	super(name,address,phone,email);
  	this.office=office;
  	this.salary=salary;																								
  	
  }
  public String toString() {
    return "Employee "+ this.getName();
  }
}

class MyDate {
  int year;
  int month;
  int day;
}

class Faculty extends Employee {

  private String officeHours;
  private int rank;

public Faculty(){
}
public Faculty(String officeHours, int rank){
	this.officeHours=officeHours;
	this.rank=rank;
}
public Faculty(String name,String address,String phone,String email, String officeHours, int rank){			
	super(name,address,phone,email,officeHours,rank);																		
	this.officeHours=officeHours;																			
	this.rank=rank;																							
}
  public String toString() {
    return "Faculty "+ this.getName();
  }
}

class Staff extends Employee {
  private String title;
  
  public Staff(){
  }
 public Staff(String title){
 	this.title=title;
 }
 public Staff(String name,String address,String phone,String email, String title){		
 	super(name,address,phone,email,title);																		
 	this.title=title;
 }
  public String toString() {
    return "Staff's title is " + title;
  }
}

Recommended Answers

All 3 Replies

Hi lumbeelock and welcome to DaniWeb :)

Your error message has been chopped, but the error relates to when you have tried to create a new Employee, the parameters you have passed in don't match the order of the available constructors. Double check your call to new Employee(...) to see that the parameters are what is expected.

public Staff(String name,String address,String phone,String email, String title){
super(name,address,phone,email,title);
this.title=title;
}

chk above code... constructor doesnt exists in Employee class. you should have 6 arguments while you are passing 5

commented: Well spotted :) +3

make this change and it will work:
//in Emplyee class add the constructor:
public Employee(String name, String address, String phoneNumber,String email) {
super(name,address,phoneNumber,email);
}
// and in the staff class change your constructor like this:
public Staff(String name,String address,String phone,String email, String title){
super(name,address,phone,email);
this.title=title;
}

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.