Почему у меня не проходят первый и последний пункт???
Ведь Класс Cat содержит всего 4 поля!
Что не так???
package com.javarush.task.jdk13.task05.task0501;
/*
Кошачья бойня(1)
*/
public class Solution {
public static class Cat {
//напишите тут ваш код
String name;
int age;
int weight;
int strength;
public Cat(String name, int age, int weight, int strength) {
this.name = name;
this.age = age;
this.weight = weight;
this.strength = strength;
}
public boolean fight(Cat anotherCat){
int a = 0;
int b =0;
if (age > anotherCat.age){
a++;
}
else if(age > anotherCat.age){
b++;
}
if (weight > anotherCat.weight){
a++;
}
else if (weight < anotherCat.weight){
b++;
}
if (strength > anotherCat.strength){
a++;
}
else if (strength < anotherCat.strength){
b++;
}
if (a > b) {
return true;
}
else{
return false;
}
}
}
public static void main(String[] args) {
Cat cat1 = new Cat("Vaska",5,5,5);
Cat cat2 = new Cat("Bob",6,4,7);
Cat cat3 = new Cat("Gav",3,7,6);
cat2.fight(cat1);
}
}