This commit is contained in:
CT
2026-04-30 19:59:29 +00:00
parent beb96d4a97
commit 15ffe12fbf

View File

@@ -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;
}