Ask Question
18 March, 10:23

For questions 19 - 21, assume that Student, Employee and Retired are all subclasses of Person, and all four classes have different implementations of the method getMoney. Consider the following code where ... are 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

The reference to getMoney () in assignment 1 is to the class

Person

Student

Employee

Retired

this cannot be determined by examining the code

+3
Answers (1)
  1. 18 March, 12:53
    0
    Person

    Explanation:

    At

    Person p = new Person ( ...);

    int m1 = p. getMoney (); / / assignment 1

    Person class which is base class for all sub class (Student, Employee and Retired) creates an object which referenced is stored in p variable, and getMoney () is method which refereed Person's getMoney () method, so Person is the answer of above question
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “For questions 19 - 21, assume that Student, Employee and Retired are all subclasses of Person, and all four classes have different ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers