Description
Using what you have learned about multilevel inheritance and classes design a set of classes
with 3 levels of inheritance (grandparent, parent, child). These classes should be able to inherit
methods and variables between them so make sure they are related.
For example (and you may use these examples, but feel free to come up with your own)
Organ – grandparent Car – grandparent Restaurant – grandparent
Illness – parent Make – parent Menu – parent
Symptom – child Model – child Food – child
The only one you are NOT allowed to use is geometicObject examples since we did them in
class.
Protip™: it might help for you to draw out a UML diagram so you can think of what functions and
variables you want to write ahead of time. You do not have to and you do not have to hand
this in, but it will serve you well before you start coding.
The following will be the marking scheme which will outline some of the requirements:
Marks
3 Implement a grandparent class, a parent class that extends from the grandparent,
and a child class that extends from the parent
3 Each class should have at least 2 variables
3 Each class should have at least 2 unique (to that level class) methods, which can
be inherited by any subclasses that extend it
3 Each class should have a constructor that sets at least 2 of the variables
1 At least one instance of an overloaded method
1 At least one instance of an overridden method
1 In your tester class show an instance of a class using a method that it inherits from
a superclass
10 You will have a tester file, in it you will exercise ALL of your methods across all 3
classes. Your tester should create instances of each class to make sure your
functions in each class work, as well as contain the example overloaded,
overridden, and your inherited example. It should also compile and run without
errors.
Y
o
u
will s
u
b
mit
t
h
e
3
cla
s
s
file
s
a
n
d
t
h
e
t
e
s
t
e
r
file
(
4
file
s
t
o
t
al)
t
o
t
h
e
C
M
S
b
y
T
h
u
r
s
d
a
y, F
e
b
1
s
t.