I'm having problems with one of my classes. Everything is fine except for the line with the super(hourly) under public HourlyEmployee(HourlyEmployee hourly). I don't know if I'm using super wrong or how to fix it. It just says "actual and formal arguments differ in length. Not sure what that means." thanks
package payrollsystem_1;
import java.util.ArrayList;
public class HourlyEmployee extends Employee {
private double hourlyRate;
private double periodHours;
public HourlyEmployee(int employeeID, String firstName, String lastName,
ArrayList<Paycheck> listOfPaychecks, double hourlyRate, double periodHours ){
super(employeeID, firstName, lastName, listOfPaychecks);
this.listOfPaychecks = listOfPaychecks;
this.hourlyRate = hourlyRate;
this.periodHours = periodHours;
}
public HourlyEmployee(HourlyEmployee hourly) {
super(hourly);
this.hourlyRate = hourly.hourlyRate;
this.periodHours = hourly.periodHours;
}
public double getHourlyRate(){
return hourlyRate;
}
public void setHourlyRate(double hourlyRate) {
this.hourlyRate = hourlyRate;
}
public double getPeriodHours() {
return periodHours;
}
public void setPeriodHours(double periodHours) {
this.periodHours = periodHours;
}
}
You need to make sure that do there has any constructors like
or
in your Employee class.If the super class 'Employee' do not have constructor like those two mentioned above. You will get the message "actual and formal arguments differ in length" when you try to compile HourlyEmployee.java.
This means that your super class 'Employee' do not have a constructor that need to pass a HourlyEmployee or it's super class instance to.
In fact, You need to show more informations about the compiler error message.I guess you got sth like this.