Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please answer all of the questions or the ones you have the answer too. No expla

ID: 3707723 • Letter: P

Question

Please answer all of the questions or the ones you have the answer too.
No explanation needed, just the answer.
Thank you!

LII Name: uppose a class Car and its subclass Honda both have a method called speed as part of the class detinition. rentalH refers to an object of the type Honda and the following statements are ID: A found in the rentalH.cost( super speed 41. In the scenario described in the accompanying figure, what will the a. The cost method in Honda will be called. b. The cost method in Car will be called. c. Nothing will be called since the code will not compile as a result of multiple definitions d. Overloading will be used to determaine which cost method to use Which of the following statements about the reference super is true? a. It must be used every time a method from the superclass is called first statement do? of speed 42. b. It must be the last statement of the subelass constructor It must be the first statement of the subclass constructor It can only be used once in a program. c. Rectangle length: double ridth: double +Rectangle() +Rectangle (double, dauble) aetDimension (double, doublei void +getLengtho: doub le 4getvidtho double +ares double +perimeter 1 double +print( voic Box height: double Box (double, doubie, double) +setDimension(double, double, doublel : void +getHeight(): double tareaf double +volume (): double +print (: voic Rectangle Box 43. Based on the diagram in the accompanying figure, the method setDimension in the ciass the method setDimension in the class Rectangle c. overstates d. deletes b. overrides

Explanation / Answer

Answers)

41) In the scenario described in the accompanying figure, what will the first statement do?

The class Car and subclass Honda both have the method speed. rentalH refers to the object of type Honda.

Thus we execute rentalH.cost(); we will:

a. The cost method in Honda will be called.

42) Which of the following statements about the reference super is true?

super.speed();

Thus by using the above statement, true are:

a. It must be used every time a method from the superclass is called.

c. It must be the first statement of the subclass constructor

43) Based on the diagram in the accompanying figure, the method setDimension in the class Box ____ the method setDimension in the class Rectangle.

b. overrides

This is because the method setDimension(double, double : void) exists in the class Rectangle.

The method setDimension (double, double, double) : void is in the Box class which extends the Rectangle class, and thus setDimension is overridden.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote