В методе fight не реализована драка двух котов. Подскажите где ошибка в коде.
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) {
//напишите тут ваш код
byte f=0; byte s = 0;
if (this.age > anotherCat.age) f++;
else
s++;
if (this.weight > anotherCat.weight) f++;
else
s++;
if (this.strength > anotherCat.strength) f++;
else
s++;
if (f > s) return true;
else
return false;
/*if (f == s) return false; */
}
public static void main(String[] args) {
Cat cat1 = new Cat();
cat1.age = 2;
cat1.weight = 4;
cat1.strength = 6;
Cat cat2 = new Cat();
cat2.age = 1;
cat2.weight = 6;
cat2.strength = 7;
if (cat1.fight(cat2)) System.out.println("Кот1 победил");
else
if (!cat1.fight(cat2)) {
if (cat2.fight(cat1)) System.out.println("Кот2 победил");
else
System.out.println("Ничья");
}
}
}