Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Teams {
- private String teamName;
- private int teamPoints;
- private String teamCountry;
- private String coachName;
- Teams(){
- this.teamName = "Team's name";
- this.teamPoints = 0;
- this.teamCountry = "Country";
- this.coachName = "Coach's name";
- }
- public String getTeamName() {
- return teamName;
- }
- public void setTeamName(String teamName) {
- this.teamName = teamName;
- }
- public int getTeamPoints() {
- return teamPoints;
- }
- public void setTeamPoints (int teamPoints) {
- this.teamPoints = teamPoints;
- }
- public String getTeamCountry() {
- return teamCountry;
- }
- public void setTeamCountry(String teamCountry) {
- this.teamCountry = teamCountry;
- }
- public String getCoachName() {
- return coachName;
- }
- public void setCoachName(String coachName) {
- this.coachName = coachName;
- }
- Teams(String name, int teamPoints, String teamCountry, String coachName){
- this.teamName = name;
- this.teamPoints = teamPoints;
- this.teamCountry = teamCountry;
- this.coachName = coachName;
- }
- boolean isAlreadyExists(Teams newTeam){
- boolean isSame;
- isSame = this.getTeamName().equalsIgnoreCase(newTeam.getTeamName());
- if (isSame){
- isSame = this.getTeamPoints() == newTeam.getTeamPoints();
- }
- if (isSame){
- isSame = this.getTeamCountry().equalsIgnoreCase(newTeam.getTeamCountry());
- }
- if (isSame){
- isSame = this.getCoachName().equalsIgnoreCase(newTeam.getCoachName());
- }
- return isSame;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement