Пытаюсь создать переменную, которая будет высчитывать победит ли кот, но мне выдает ошибку, якобы Не могу найти описание переменной "score", почему я не могу её создать?
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();
Cat cat2 = new Cat();
cat1.weight = 3;
cat1.age = 4;
cat1.strength = 6;
cat2.age = 6;
cat2.strength = 5;
cat2.weight = 4;
int score = (weight * 2) + (strength * 3) - (age * 2);
if (cat1.score < cat2.score) {
return false;
} else {
return true;
}
}
public static void main(String[] args) {
}
}