add ppg
This commit is contained in:
@@ -42,12 +42,16 @@ public class HockeyPlayer {
|
||||
return gamesWon + gamesLost;
|
||||
}
|
||||
|
||||
public double getPointsPerGame(){
|
||||
return (double) getPoints() / (double) getGamesPlayed();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String s =
|
||||
String.format(
|
||||
"Name: %s%nGoals: %d\tAssists: %d\tPoints: %d%nGames Won: %d\tGames Lost: %d\tGames"
|
||||
"Name: %s%nGoals: %d\tAssists: %d\tPoints: %d\tPoints Per Game: %d%nGames Won: %d\tGames Lost: %d\tGames"
|
||||
+ " Played: %d%n",
|
||||
name, goals, assists, getPoints(), gamesWon, gamesLost, getGamesPlayed());
|
||||
name, goals, assists, getPoints(), getPointsPerGame(), gamesWon, gamesLost, getGamesPlayed());
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user