Подскажите, пожалуйста, что не так с моей реализацией драки?
package com.javarush.task.jdk13.task05.task0501;
/*
Кошачья бойня(1)
*/
import java.util.Random;
public class Solution {
public static class Cat {
//напишите тут ваш код
private String name;
private int age;
private int weight;
private int strength;
public Cat(String name, int age, int weight, int strength) {
this.name = name;
this.weight = weight;
this.strength = strength;
this.age = age;
}
public boolean fight(Cat anotherCat) {
int ageScore;
if (age > 3 && age <= 10) {
ageScore = 1;
} else ageScore = 0;
int ageScore2;
if (anotherCat.age > 3 && anotherCat.age <= 10) {
ageScore2 = 1;
} else ageScore2 = 0;
int publicAgeScore = Integer.compare(ageScore, ageScore2);
int weight = Integer.compare(this.weight, anotherCat.weight);
int strength = Integer.compare(this.strength, anotherCat.strength);
int publicScore = weight + strength + publicAgeScore;
return publicScore > 0;
}
}
public static void main(String[] args) {
Random random = new Random();
Cat cat1 = new Cat("Tom", 1 + random.nextInt(20), 1 + random.nextInt(25), 1 + random.nextInt(100));
Cat cat2 = new Cat("Semen", 1 + random.nextInt(20), 1 + random.nextInt(25), 1 + random.nextInt(100));
Cat cat3 = new Cat("Jerry", 1 + random.nextInt(20), 1 + random.nextInt(25), 1 + random.nextInt(100));
}
}