41 lines
957 B
Java
Raw Normal View History

2020-11-11 08:47:37 -05:00
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
}
}