Всем привет!
Помогите разобраться почему не проходит проверку.
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) {
boolean WinWeight = this.weight > anotherCat.weight;
boolean WinAge = this.age > anotherCat.age;
boolean WinStrenght = this.strength > anotherCat.strength;
boolean[] Win = { WinWeight, WinAge, WinStrenght};
boolean win = false;
int Count = 0;
for(int i = 0; i < Win.length; i++) {
if(Win[i] == true)
Count++;
}
if(Count >= 2)
win = true;
return win;
}
public static void main(String[] args) {
Cat cat1 = new Cat();
cat1.age = 4;
cat1.weight = 4;
cat1.strength = 7;
Cat cat2 = new Cat();
cat2.age = 4;
cat2.weight = 4;
cat2.strength = 9;
System.out.println(cat1.fight(cat2));
System.out.println(cat2.fight(cat1));
}
}
WinWeightwinWeight и т.д.