Прошу помощи, все проверки прошли нормально, кроме "В классе Cat должен быть метод fight."
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 charP = 0;
if (this.age > anotherCat.age) charP++;
else if (this.age < anotherCat.age) charP--;
if (this.strength > anotherCat.strength) charP++;
else if (this.strength < anotherCat.strength) charP--;
if (this.weight > anotherCat.weight) charP++;
else if (this.weight < anotherCat.weight) charP--;
if (charP > 0)
return true;
else if (charP < 0)
return false;
if (this.age == anotherCat.age && this.weight == anotherCat.weight && this.strength == anotherCat.strength)
if (this.fight(anotherCat) == true && anotherCat.fight(this) == false)
return true;
else if (this.fight(anotherCat) == false && anotherCat.fight(this) == true)
return true;
return true;
}
public static void main(String[] args) {
}
}