Question: Create a main program class called AllStarRoster AllStarRoster should have the following specs: A main method that creates and array of HockeyPlayer objects of size

Create a main program class called AllStarRoster

AllStarRoster should have the following specs:

A main method that creates and array of HockeyPlayer objects of size 6

Populate the 6 indexes with hockey player objects

Create a for each loop that will print all the player info you entered.

ProPlayer.java

public abstract class ProPlayer

{

protected String name;

private float baseSalary=0;

public ProPlayer(String name) {

this.name = name;

}

public float getBaseSalary() {

return baseSalary;

}

public void printName(){

System.out.println(name);

}

abstract float computePay();

}

HockeyPlayer.java

public class HockeyPlayer extends ProPlayer {

String teamName; float bonusPay;

public HockeyPlayer(String teamName, float bonusPay, String name) { super(name); this.teamName = teamName; this.bonusPay = bonusPay; } public float calculatedPay(){ return this.bonusPay + super.getBaseSalary(); }

public void printName(){ System.out.println("Player : "+super.name ); System.out.println("Team Name : "+teamName); System.out.println("Salary : "+this.computePay()); }

float computePay() { return this.bonusPay + super.getBaseSalary(); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!