Today my teacher told me that I did my Student class wrong. I made it my main class, but he said it wasn't supposed to be the main class--so yes, this is a homework question. I would like to know what I should add to do to my subclass make the Student class, I suppose, connect (for a lack of a better word--I'm tired I guess) the three other classes to Student (I don't know if that made sense, just keep going and hopefully it starts making more sense).
Here are the specifics: I created three student instances, each student from different schools, with different grade levels, different social security numbers, etc. I did the same for all of them, so here is the class for a student from Colorado College:
public class UCCSStudent {
String firstName;
String lastName;
String gradeLevel;
int age;
private int ssNum;
private static int numOfObj;
private String campus;
UCCSStudent(){
firstName = "Jane";
lastName = "Lo";
gradeLevel = "Junior";
age = 22;
ssNum = 90123456;
campus = "The University of Colorado at Colorado Springs";
numOfObj++;
}
int getssNum(){
return ssNum;
}
void getssNum(int thenewSsnum){
ssNum = thenewSsnum;
}
String getcampus(){
return campus;
}
void setcampus(String anotherCampus){
campus = anotherCampus;
}
static int getnumOfObj(){
return numOfObj;
}
public String toString(){
return "The first name of this student is: " + this.firstName + ", the "
+ "last name of this student is: " + this.lastName + ", the "
+ "student ID of this student is: " + this.getssNum() + ", the "
+ "grade level of the student is: " + this.gradeLevel + ", & the "
+ "campus this student goes to is: " + this.getcampus() + ".";
}
}
And then this is my Student class. From what I understood, this class is the "recipe for creating instances"--this is what I have as of now:
public class Student {
//declare variables
String firstName;
String lastName;
String gradeLevel;
int age;
private int ssNum;
private static int numOfObj;
private String campus;
}
(I'm doing this so you guys don't think I haven't started or something)
I hope I was specific enough. So, anyways, in case my question was lost in all the action: What should I add to Student now? The purpose of the homework is to "design a hierarchy of classes and subclasses"
Please Note: I don't need the specific code, just what to do next. EDIT: The student class was the main class, but isn't anymore. I took out the public static void main(String[] args)