Refer to Example Code Ch 09-6: The reference to getMoney() in assignment 2 is to the class a. Person b. Student c. Employee d. Retired e. This cannot be determined by examining the code
Example Code Ch 09-6
Assume that Student, Employee and Retired are all extended classes of Person, and all four
classes have different implementations of the method getMoney. Consider the following code where
... indicates the required parameters for the constructors:
Person p = new Person(...);
int m1 = p.getMoney(); // assignment 1
p = new Student(...);
int m2 = p.getMoney(); // assignment 2
if (m2 < 100000)
p = new Employee(...);
else if (m1 > 50000)
p = new Retired(...);
int m3 = p.getMoney(); // assignment 3
24. Refer to Example Code Ch 09-6: The reference to getMoney() in assignment 2 is to the class
a. Person
b. Student
c. Employee
d. Retired
e. This cannot be determined by examining the code
Trending now
This is a popular solution!
Step by step
Solved in 2 steps