Helpful Information
 
 
Category: Java
Trouble with inheritance

Ok i am trying to get these childer classes to go back to the parent but i am having trouble. here is what i need the structure to look like.


Student ->Highschool, Middleschool, College ( -> undergrad and graduate)


I am having trouble with taking the info from grad. and undergrad back through to college then to student.
Here are the errors i am receiving when i try to compile College.java and College.java

College.java:8: cannot find symbol
symbol : variable sID
location: class College
super(sName, sAge, sID, sSchoolName, sGPA);
^
Graduate.java:8: cannot reference major before supertype constructor has been called
super(name, age, id, schoolName, gpa, major, minor, time);
^
Graduate.java:8: cannot reference minor before supertype constructor has been called
super(name, age, id, schoolName, gpa, major, minor, time);
^
Graduate.java:16: cannot find symbol
symbol : variable temp
location: class Graduate
return temp + "\nGraduate degree to be aquired: "+gradDegree+ "\nGRE score: "+GRE;

here is the code

class College extends Student
{
boolean time;
String major, minor;

public College(String sName, int sAge, int sId, String sSchoolName, double sGPA, String sMajor, String sMinor, boolean sTime)
{
super(sName, sAge, sID, sSchoolName, sGPA);
time = sTime;
major = sMajor;
minor = sMinor;
}

public String toString()
{
String temp = super.toString();
return temp + "\nMajor: "+major+"\nMinor: "+minor+"\n"+time;
}
}

class Graduate extends College
{
String gradDegree;
int GRE;

public Graduate(String name, int age, String schoolName, int id, double gpa, String maj, String min, boolean time, int gre, String degree)
{
super(name, age, id, schoolName, gpa, major, minor, time);
gradDegree = degree;
GRE = gre;
}

public String toString()
{
String temp1 = super.toString();
return temp + "\nGraduate degree to be aquired: "+gradDegree+ "\nGRE score: "+GRE;
}
}

College.java:8: cannot find symbol
symbol : variable sIDCase-sensitivity has bitten you again: you defined it as sId.

Ahhh yeah thanks!










privacy (GDPR)