Решение не принято: требуется проверить если два условия будут равны, а одно отличаться.
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 x = 0;
int y = 0;
if(this.age == anotherCat.age){
x = 0;
y = 0;
}
if (this.weight == anotherCat.weight){
x = 0;
y = 0;
}
if(this.strength == anotherCat.strength){
x = 0;
y = 0;
}
if(this.age > anotherCat.age) {
x ++;
}
else {
y ++;
}
if(this.weight > anotherCat.weight) {
x ++;
}
else {
y ++;
}
if(this.strength > anotherCat.strength) {
x ++;
}
else {
y ++;
}
if(x > y)
return true;
else if(x <= y)
return false;
return true;//напишите тут ваш код
}
public static void main(String[] args) {
}
}