Ok i am working on this program that deals with inheritance. I start out with a Student parent class then i am going to have a college, middle school, and high school children.
Currently i have got the middle school and almost have the high school. the middle school seems to be working fine but the high school is not even though they seem to be the same.
Here is my high school class
and here is my middle schoolCode:class HighSchool extends Student { int gradYear2, credLeft, SAT, apCred; public HighSchool(String name, int age, String schoolName, int id, double gpa, int graduationYear, int creditLeft, int sat, int apCredit); { super(name, age, id, schoolName, gpa); gradYear2 = graduationYear; credLeft = creditLeft; SAT = sat; apCred = apCredit; } public String toString() { String temp = super.toString(); return temp + "Graduation Year: " +gradYear+ "\nCredits Left: "+credLeft+"\nSAT Score: "+SAT+"\nAP Credits Taken: "+apCred; } }
the errors i am getting are :Code:class MiddleSchool extends Student { int gradYear1; public MiddleSchool(String name, int age, String schoolName, int id, double gpa, int gradYear) { super(name, age, id, schoolName, gpa); gradYear1 = gradYear; } public String toString() { String temp = super.toString(); return temp + gradYear1; } }
HighSchool.java:4: missing method body, or declare abstract
public HighSchool(String name, int age, String schoolName, int id, double gpa, int graduationYear, int creditLeft, int sat, int apCredit);
^
HighSchool.java:6: call to super must be first statement in constructor
super(name, age, id, schoolName, gpa);
^
HighSchool.java:7: cannot find symbol
symbol : variable graduationYear
location: class HighSchool
gradYear2 = graduationYear;
any suggestions?



Reply With Quote

Bookmarks