package com.javarush.task.task05.task0502; /* Реализовать метод fight */ public class Cat { public int age; public int weight; public int strength; public Cat() { } public boolean fight(Cat anotherCat) { int win1 = 0; int win2 = 0; if (this.age > anotherCat.age) win1++; if (this.age < anotherCat.age) win2++; if (this.weight > anotherCat.weight) win1++; if (this.weight < anotherCat.weight) win2++; if(this.strength > anotherCat.strength) win1++; if(this.strength < anotherCat.strength) win2++; if(this.strength == anotherCat.strength) win1++ ; win2++; if(this.weight == anotherCat.weight) win1++ ; win2++; if(this.strength == anotherCat.strength) win1++ ; win2++; int win = win1 - win2; if (win>0)return true; else if (win<0)return false; else return false; } public static void main(String[] args) { Cat cat2 = new Cat(); cat2.age = 4; cat2.weight = 4; cat2.strength = 4; Cat cat1 = new Cat(); cat1.age = 5; cat1.weight = 4; cat1.strength = 4; System.out.println(cat1.fight(cat2)); } }