huge update idk

This commit is contained in:
CT
2026-04-25 17:14:35 -05:00
parent 1bd20c4af4
commit 3b2520df35
8 changed files with 89 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
public class HockeyPlayer {
String name;
int goals, assists, gamesWon, gamesLost;
private String name;
private int goals, assists, gamesWon, gamesLost;
public HockeyPlayer(String n, int g, int a, int gw, int gl) {
name = n;
@@ -14,6 +14,26 @@ public class HockeyPlayer {
this.name = name;
}
public String getName() {
return name;
}
public int getGoals() {
return goals;
}
public int getAssists() {
return assists;
}
public int getGamesWon() {
return gamesWon;
}
public int getGamesLost() {
return gamesLost;
}
public int getPoints() {
return goals + assists;
}
@@ -25,12 +45,16 @@ public class HockeyPlayer {
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%nGames Won: %d\tGames Lost: %d\tGames"
+ " Played: %d%n",
name, goals, assists, getPoints(), gamesWon, gamesLost, getGamesPlayed());
return s;
}
public String getData() {
return String.format("%s %d %d %d %d", name, goals, assists, gamesWon, gamesLost);
}
public boolean equals(Object o) {
HockeyPlayer p = (HockeyPlayer) o;
return this.name.equals(p.name);