Given:
abstract public class Employee {
protected abstract double getSalesAmount();
public double getCommision() {
return getSalesAmount() * 0.15;
}
}
class Sales extends Employee {
17. // insert method here
}
Which two methods, inserted independently at line 17, correctly complete the Sales class? (Choose two.)
A.
double getSalesAmount() { return 1230.45; }
B.
public double getSalesAmount() { return 1230.45; }
C.
private double getSalesAmount() { return 1230.45; }
D.
protected double getSalesAmount() { return 1230.45; }
Explanation:
A:
Main.java:17: getSalesAmount() in Sales cannot override getSalesAmount() in Employee; attempting to assign weaker access privileges; was protected
double getSalesAmount() { return 1230.45; }
^
1 errorB:
compiled successfullyC:
Main.java:17: getSalesAmount() in Sales cannot override getSalesAmount() in Employee; attempting to assign weaker access privileges; was protected
private double getSalesAmount() { return 1230.45; }
^
1 errorD:
compiled successfully