Валидация падает на "Проверь, что метод fight работает правильно, если у котов два параметра равны, и только один отличается."
А зачем если я буквально по количеству баллов считаю?
/*
Реализовать метод fight
*/
public class Cat {
public int age;
public int weight;
public int strength;
public Cat() {
}
public boolean fight(Cat anotherCat) {
//напишите тут ваш код
int cat1 = 0;
int cat2 = 0;
if (this.age <= anotherCat.age)
cat2++;
else cat1++;
if (this.strength <= anotherCat.strength)
cat2++;
else cat1++;
if (this.weight <= anotherCat.weight)
cat2++;
else cat1++;
if (cat1 > cat2)
return true;
else return false;
}
public static void main(String[] args){
}
}
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 sum1 = cat1.age + cat1.strength + cat1.weight;
// int sum2 = anotherCat.age + anotherCat.weight + anotherCat.strength;
int cat1 = 0;
int cat2 = 0;
if (this.age <= anotherCat.age)
cat2++;
else cat1++;
if (this.strength <= anotherCat.strength)
cat2++;
else cat1++;
if (this.weight <= anotherCat.weight)
cat2++;
else cat1++;
if (cat1 > cat2)
return true;
else return false;
// if (this.age > anotherCat.age && this.weight > anotherCat.weight && this.weight > anotherCat.strength )
// return true;
// if (this.age <= anotherCat.age || this.weight <= anotherCat.weight || this.weight <= anotherCat.strength)
// return false;
}
public static void main(String[] args){
}
}