Помогите понять, почему предложенный код не проходит по с реализацией механизма драки.
Вроде условия составил, они проверки проходят, а этот пункт не принимается.
Почитал комментарии, все равно не пойму где проблема.
ПОМОГИТЕ!!!
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 i1 = 0;
int i2 = 0;
if (this.age > anotherCat.age){
i1 = i1 + 10;
i2 = i2 + 9;}
else if (this.age == anotherCat.age){
i1 = i1 + 9;
i2 = i2 + 9;
}
else {
i1 = i1 + 9;
i2 = i2 + 10;
}
if (this.weight > anotherCat.weight){
i1 = i1 + 10;
i2 = i2 + 9;}
else if (this.weight == anotherCat.weight){
i1 = i1 + 9;
i2 = i2 + 9;
}else {
i1 = i1 + 9;
i2 = i2 + 10;
}
if (this.strength > anotherCat.strength){
i1 = i1 + 10;
i2 = i2 + 9;}
if (this.strength == anotherCat.strength){
i1 = i1 + 9;
i2 = i2 + 9;}
else {
i1 = i1 + 9;
i2 = i2 + 10;
}
if (i1 > i2){
return true;
}
else if (i1 == i2){
return false;
}
else return false;
}
public static void main(String[] args) {
Cat Vasya = new Cat();
Vasya.weight = 6;
Vasya.age = 2;
Vasya.strength = 16;
Cat Sanya = new Cat();
Sanya.weight = 6;
Sanya.age = 2;
Sanya.strength = 16;
System.out.println(Sanya.fight(Vasya));
System.out.println(Vasya.fight(Sanya));
}
}