Писал , пробовал , создавал котов , вроде все работает . Сдаю на проверку , не хочет. Не могу понять логику как еще их сравнить .
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 sumCat1 = 0;
int sumCat2 = 0;
if (this.age > anotherCat.age){
sumCat1++;
}
else if(this.age != anotherCat.age){
sumCat2++;
}
if (this.strength > anotherCat.age){
sumCat1++;
}
else if (this.strength != anotherCat.strength){
sumCat2++;
}
if (this.weight > anotherCat.weight) {
sumCat1++;
}
else if (this.weight != anotherCat.weight){
sumCat2++;
}
if (sumCat1 == sumCat2) {
return false;
}
else if(sumCat1 > sumCat2){
return true;
}
else {
return false;
} //напишите тут ваш код
}
public static void main(String[] args) {
}
}