void setPlayerID() which increments the idCounter and then sets the playerID to the concatenation of the String “PlayerID_” and the idCounter

computer science

Description

class Player is abstract (25)

 

class Player implements the Comparable interface for Player, based on position in the draft, with lower number preceding the higher.  (i.e. 1 precedes 2).  Remember, there is a method you must implement (you need to remember what this method is, as it isn’t listed below)..

 

class Player has the following instance variables:

String playerID

String teamName

int roundSelected

int draftPickNumber

double salary

 

There is one class variable:

static int idCounter  initialized to 0

There is a single constructor with no parameters that calls setPlayerID

 

class Player has the following methods:

void setPlayerID() which increments the idCounter and then sets the playerID to the concatenation of the String “PlayerID_” and the idCounter

 

void setSalary() whichcalculates the player salary as follows:

Add one to the difference between League static variable totalRounds and the class variable roundSelected and multiply by .25 time the League static variable baseSalary.

Then

Add one to the difference between League static variable totalDrafted and the class variable draftPickNumber and multiply by .35 time the League static variable baseSalary.

The sum of those two is the salary.

 

The following mutators do the obvious

void setTeamName(String tName)

void setRoundSelected(int rSelected)

void setDraftPickNumber(int dPickNo)

 

Each of the 5 class variables also has an accessor method.

 

There is a toString() method which might look like this:

Player PlayerID_61 on team Patriots with draft number 1 picked in round 1 has salary $14,087,500

 

There are two abstract methods:

abstract void setPosition();

abstract String getPosition();


 

class OffensivePlayer is a subclass of Player (10)

 

class OffensivePlayer has the following additional instance variable:

String position

 

The constructor has no parameters and calls the constructor of its parent.

 

class  OffensivePlayer has the following methods:

void setPosition() which does the following:

Calculate a number from 0 to 3 based on the product of the roundSelected and the draftPick number using a modulo operator. (Note: you will need to get these values using accessor methods.)

Assign the position based on number as follows:

0 – Quarterback

1 - Running Back

2 - Tight End

3 - Wide Receiver

 

Include an accessor method for position.

Override the toString() method so that the output would look like the following:

Player PlayerID_95 on team Chargers with draft number 15 picked in round 4 has salary $12,675,000 and has position Quarterback

 

class DefensivePlayer is a subclass of Player (10)

 

class DefensivePlayer has the following additional instance variable:

String position

 

The constructor has no parameters and call the constructor of its parent.

class DefensivePlayer has the following methods:

void setPosition() which does the following:

Calculate a number from 0 to 3 based on the product of the roundSelected and the draftPick number using a modulo operator. (Note: you will need to get these values using accessor methods.)

Assign the position based on number as follows:

0 – Defensive Tackle

1 - Defensive End

2 – Line Backer

3 - Safety

 

Include an accessor method for position.

Override the toString() method so that the output would look like the following:

Player PlayerID_10 on team Chargers with draft number 23 picked in round 6 has salary $11,850,000 and has position Linebacker


 


Related Questions in computer science category