?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Athlete Class Design

APCSA-VNNT1E

Consider the following program design.

public abstract class Athlete 
{
    private String name;
    private String sport;
    private int ranking, age;

    public abstract void playSport();

    public void getAgeAndRanking()
    {
        // code not shown
    }    

    // other data and methods not shown
}

public class FootballPlayer extends Athlete 
{
    public void playSport()
    {
        // code not shown
    }    

    // other data and methods not shown
}

public class Golfer extends Athlete 
{
    public void playSport()
    {
        // code not shown
    }    

    // other data and methods not shown
}

What is a valid reason for designing the class relationships in this manner?

A

The subclasses of Athlete are required to define both the playSport() and getAgeAndRanking() methods as their sport requires.

B

Football players and golfers essentially play their sports in different ways. However, retrieving their age and ranking is done the same way.

C

All methods in both the FootballPlayer and Golfer classes are designed identically.

D

Football players and golfers essentially play their sports the same way.

E

A top football player is an athlete that makes more money than a top golfer.