В общем, убив несколько часов и сломав голову, посмотрел комментарии, дабы понять куда вообще двигаться после объявления переменных, создал два счетчика count, описал условия, когда и что прибавляется, но не понимаю как итоговое true и false вывести, ведь у нас закрывает else count2++, после него елсе не могу использовать
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) {
//напишите тут ваш код
Cat cat1=new Cat();
this.age=5;
this.weight=7;
this.strength=12;
Cat cat2=new Cat();
cat2.age=2;
cat2.weight=5;
cat2.strength=14;
int count=0;
int count2=0;
if (this.age>anotherCat.age){
count++;
} else if (this.age==anotherCat.weight) {
count++;
count2++;
} else if (this.weight>anotherCat.weight){
count++;
} else if (this.weight==anotherCat.weight){
count++;
count2++;
} else if (this.strength>anotherCat.strength){
count++;
} else if (this.strength==anotherCat.strength) {
count++;
count2++;
} else {
count2++;
} if (count>count2){
return true;
} else {
return false;
}
}
public static void main(String[] args) {
}
}