Ex 6: Creating a subclass
NOT TURNED IN
Below is a class called
Student. The class
Student is a generic
class that lists information about the student. You are to design and create
two sub-classes of
Student called:
Undergrad and
Graduate.
The class
Undergrad should contain:
- Capstone = title of capstone project.
- Internship = Numer of internships that student has performed.
- anything elese you think is appropriate.
The class
Graduate should contain:
- Thesis = title of thesis.
- Papers = Numer of papers the student has published.
- anything elese you think is appropriate.
You must also create another class called
School which has a
main()
method that creates a few
Undergrad and
Graduate objects and
after setting information prints outs this information to the screen.
class Student {
String Name;
int age;
int SSNum;
String Advisor;
void PrintInfo() {
System.out.println("Name: " + Name);
System.out.println("age: " + age);
System.out.println("SS# : " + SSNum);
System.out.println("Advisor: " + Advisor);
}
}
© Lynne Grewe