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
-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
Correct Answer:
Verified
Q30: Example Code Ch 09-5
Consider the following class
Q31: All classes in Java are directly or
Q32: Example Code Ch 09-5
Consider the following class
Q34: Which of the following is true about
Q34: If you instantiate an abstract class, the
Q36: Example Code Ch 09-6
Assume that Student, Employee
Q37: Which of the following is not a
Q38: Example Code Ch 09-6
Assume that Student, Employee
Q39: The relationship between a parent class and
Q40: Two children of the same parent class
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