For a homework assignment, I'm working with the following. It's an assigned class structure, I know it's not the best design by a long shot.
Class | Extends | Variables
--------------------------------------------------------
Person | None | firstName, lastName, streetAddress, zipCode, phone
CollegeEmployee | Person | ssn, salary,deptName
Faculty | CollegeEmployee | tenure(boolean)
Student | person | GPA,major
So in the Faculty class...
public class Faculty extends CollegeEmployee
{
protected String booleanFlag;
protected boolean tenured;
public Faculty(String firstName, String lastName, String streetAddress,
String zipCode, String phoneNumber,String ssn,
String department,double salary)
{
super(firstName,lastName,streetAddress,zipCode,phoneNumber,
ssn,department,salary);
String booleanFlag = JOptionPane.showInputDialog
(null, "Tenured (Y/N)?");
if(booleanFlag.equals("Y"))
tenured = true;
else
tenured = false;
}
}
It was my understanding that super() in Faculty would allow access to the variables in CollegeEmployee as well as Person. With the code above, it compiles fine when I ONLY include the Person variables. As soon as I try to use ssn, department, or salary I get the following compile errors.
Faculty.java:15: error: constructor CollegeEmployee in class CollegeEmployee can not be applied to the given types:
super(firstName,lastName,streetAddress,zipCode,phoneNumber,ssn,department,salary);
^
Required: String,String,String,String,String
Found: String,String,String,String,String,String,String,String
reason: actual and formal argument lists differ in length
I'm completely confused by this error...which is the actual and formal? Person has five arguments, CollegeEmployee has 3, so my guess is that something's funky with how the parameters are being passed...but I'm not quite sure where to begin fixing it. What am I missing?