41 lines
957 B
Java
41 lines
957 B
Java
|
public class Team {
|
||
|
// TODO: Declare private fields - teamName, teamWins, teamLosses
|
||
|
private String teamName;
|
||
|
private int teamWins;
|
||
|
private int teamLosses;
|
||
|
|
||
|
|
||
|
// TODO: Define mutator methods -
|
||
|
// setTeamName(), setTeamWins(), setTeamLosses()
|
||
|
public void setTeamName(String name){
|
||
|
teamName=name;
|
||
|
}
|
||
|
public void setTeamWins(int wins){
|
||
|
teamWins = wins;
|
||
|
}
|
||
|
public void setTeamLosses(int lose){
|
||
|
teamLosses = lose;
|
||
|
}
|
||
|
|
||
|
|
||
|
// TODO: Define accessor methods -
|
||
|
// getTeamName(), getTeamWins(), getTeamLosses()
|
||
|
public String getTeamName(){
|
||
|
return teamName;
|
||
|
}
|
||
|
public int getTeamLosses(){
|
||
|
return teamLosses;
|
||
|
}
|
||
|
public int getTeamWins(){
|
||
|
return teamWins;
|
||
|
}
|
||
|
|
||
|
|
||
|
// TODO: Define getWinPercentage()
|
||
|
public double getWinPercentage(){
|
||
|
return (double)teamWins / (teamWins + teamLosses); //Java is not smart about doubles double avg = 1/2 results in int div
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|