question archive Draw an inheritance hierarchy for students at a university similar to the hierarchy shown in Fig
Subject:Computer SciencePrice:2.89 Bought3
Draw an inheritance hierarchy for students at a university similar to the hierarchy shown in Fig. 9.2. Use Student as the superclass of the hierarchy, then extend Student with classes Undergraduate Student and Graduate Student. Continue to extend the hierarchy as deep (i.e., as many levels) as possible. For example, Freshman, Sophomore, Junior and Senior might extend Undergraduate Student, and Doctoral Student and Masters Student might be subclasses of Graduate Student.
After drawing the hierarchy, discuss the relationships that exist between the classes.
class Student
{
StudentID
Name
DOB
Student(studid,nm,bdate) {}
/accessor techniques
}
/class UndergraduateStudent and GraduateStudent acquires Student
class UndergraduateStudent broadens Student
{
}
class GraduateStudent broadens Student
{
}
/classes that acquires UndergraduateStudent class
class Freshman broadens UndergraduateStudent
{
YearofPassing
Grade
Foundation
/getter and setter techniques
}
class Sophomore broadens UndergraduateStudent
{
}
class Junior broadens UndergraduateStudent
{
YearofPassing
Grade
Foundation
Subjectstaken
/getter and setter techniques
}
class Senior broadens UndergraduateStudent
{
YearofPassing
Grade
Foundation
Subjectstaken
/getter and setter techniques
}
/classes that acquires GraduateStudent
class MastersStudent broadens GraduateStudent
{
YearofPassing
Grade
Foundation
SubjectofSpecialization
/getter and setter techniques
}
class DoctoralStudent broadens GraduateStudent
{
SubjectofSpecialization
GuidingProfessor
/getter and setter techniques
}
The class Student will have some fundamental part variables and strategies. The part variables may incorporate points of interest like StudentID, Name and so on which will private variables. The strategies may incorporate constructor with parameters like ID and name and the accessor techniques which will have community mode.
The acquiring classes like UndergraduateStudent and GraduateStudent may have further subtle elements. The acquiring classes of these classes UndergraduateStudent and GraduateStudent like FreshMan.Sophomore,Masters and so on will have points of interest like YearofPassing, Grade, Istitutiion and so forth. The principle join between every one of the classes and its guardian classes will be the StudentID.