Limited access

Upgrade to access all content for this subject

Consider the following classes.

public abstract class Mower {

    public double gasConsumption() ;

    public void cutGrass(double sqFt);

   // data and other methods not shown
}

public class RidingMower extends Mower {

    public double gasConsumption( ) { // Implementation not shown }

    public void cutGrass(double sqFt) { // Implementation not shown }

    public double getTurningRadius() { // Implementation not shown }

   // data and other methods not shown
}  

public class PushMower extends Mower {

    public double gasConsumption( ) { // Implementation not shown }

    public void cutGrass(double sqFt) { // Implementation not shown }

    public int getMowerHeight() { // Implementation not shown }

   // data and other methods not shown
}

Assume that valid parameters are passed to the constructors.

Which of these sections of code is will NOT compile?

A
Mower m = new RidingMower( /* valid parameters */ );
m.cutGrass(25.0);
B
PushMower p = new PushMower( /* valid parameters */ );
int height = p.getMowerHeight();
C
Mower m = new RidingMower( /* valid parameters */ );
double radius = m.getTurningRadius();
D
RidingMower m = new RidingMower( /* valid parameters */ );
m.cutGrass(20.50);
E
Mower p = new PushMower( /* valid parameters */ );
double radius = p.gasConsumption();
Select an assignment template