все учтено, но пишет, что нет зависимости от веса и тп. хотя все остальные условия сходятся
public class Cat {
public int age;
public int weight;
public int strength;
public Cat() {
}
public boolean fight(Cat anotherCat) {
//напишите тут ваш код
int cats1 = 0;
if (this.weight > anotherCat.weight)
cats1 = cats1 + 1;
if (this.age > anotherCat.age)
cats1 = cats1 + 1;
if (this.strength > anotherCat.strength)
cats1 = cats1 + 1;
return (cats1 > 1);
}
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 cats1 = 0;
if (this.weight > anotherCat.weight)
cats1 = cats1 + 1;
if (this.age > anotherCat.age)
cats1 = cats1 + 1;
if (this.strength > anotherCat.strength)
cats1 = cats1 + 1;
return (cats1 > 1);
}
public static void main(String[] args) {
}
}