Ask Question
11 February, 22:12

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

+2
Answers (1)
  1. 11 February, 22:36
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers