For the questions below, 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 ... 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
A) Person
B) Student
C) Employee
D) Retired
E) none of the above, this cannot be determined by examining the code
Correct Answer:
Verified
Q2: Interface classes cannot be extended but classes
Q3: Which of the following is not a
Q18: If a programmer writes a class wanting
Q20: For the questions below, consider the following
Q21: As described in the Software Failure, the
Q22: If you instantiate an Abstract class, the
Q24: Which of these is correct?
A) a base
Q25: Why shouldn't an abstract method be declared
Q27: For the questions below, assume that Student,
Q28: A derived class has access to all
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents