Что не так? все работает, но пишет обратное. Спасибо.
package com.javarush.task.task05.task0502;
/*
Реализовать метод fight
*/
public class Cat {
private int age = 0;
private int weight = 0;
private int strength = 0;
public Cat(int age, int weight, int strength) {
this.age = age;
this.weight = weight;
this.strength = strength;
}
public boolean fight(Cat anotherCat) {
//напишите тут ваш код
//механизм драки котов 2
int ageAdvantage = this.age > anotherCat.age ? 1 : 0;
int weightAdvantage = this.weight > anotherCat.weight ? 1 : 0;
int strengthAdvantage = this.strength > anotherCat.strength ? 1 : 0;
int score = ageAdvantage + weightAdvantage + strengthAdvantage;
//System.out.println("бой " + score);
//return score > 2;
return score > 2 ? true : false;
}
public static void main(String[] args) {
Cat cat1 = new Cat(11, 7, 10);
Cat cat2 = new Cat(6, 5, 8);
System.out.println(cat1.fight(cat2));
}
}