nerdexam
Oracle

1Z0-851 · Question #94

Given: 08. abstract public class Employee { 09. protected abstract double getSalesAmount(); 10. 11. public double getCommision() { 12. return getSalesAmount() * 0.15; 13. } 14. } 16. class Sales…

The correct answer is B. public double getSalesAmount() { return 1230.45; } D. protected double getSalesAmount() { return 1230.45; }. See the full explanation below for the reasoning.

Question

Given: 08. abstract public class Employee { 09. protected abstract double getSalesAmount(); 10. 11. public double getCommision() { 12. return getSalesAmount() * 0.15; 13. } 14. } 16. class Sales extends Employee { 17. // insert method here 18. } Which two methods, inserted independently at line 17, correctly complete the Sales class? (Choose two.)

Options

  • Adouble getSalesAmount() { return 1230.45; }
  • Bpublic double getSalesAmount() { return 1230.45; }
  • Cprivate double getSalesAmount() { return 1230.45; }
  • Dprotected double getSalesAmount() { return 1230.45; }

How the community answered

(35 responses)
  • A
    6% (2)
  • B
    83% (29)
  • C
    11% (4)

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice