a. Write a class Person. It shouldhave the data members name and age b. Write a
ID: 3614016 • Letter: A
Question
a. Write a class Person. It shouldhave the data members name and age
b. Write a class Student. Student isa person. Student should have the data members GPA and school.
c. Write a class Undergrad Student.Undergrad student is a student. An undergrad student will have thedata member year (e.g. freshman, sophomore, junior, senior )
d. Write a class Teacher. Teacher isa person. Teacher should have data members subject and salary
e. Define get and set methods for thedata members of each class.
f. Write parameterizedconstructor for each class. Use super keyword to call constructorof base class from derived class.
g. Write a class Inheritance Test inwhich instantiate an object of each of the above classes. For e.g.person1, student1, teacher1 etc.
h. Display the name of each objectinstantiated in the Inheritance Test class.
i. Display the GPA of theobject of graduate student class.
j. Display the age of theobject of undergraduate student class.
Explanation / Answer
that is 4 classes, you should ask one at a time...
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.