В методе fight реализовать механизм драки котов в зависимости от их веса, возраста и силы согласно условию.
package com.javarush.task.task05.task0502;
public class Cat {
public int age;
public int weight;
public int strength;
public boolean fight(Cat anotherCat) {
//напишите тут ваш код
int cout1=0, count2=0;
if (this.age>anotherCat.age)
cout1++;
else
count2++;
if (this.weight>anotherCat.weight)
cout1++;
else
count2++;
if (this.strength>anotherCat.strength)
cout1++;
else
count2++;
if (cout1>count2)
return true;
else return false;
}
public static void main(String[] args) {
Cat cat1 = new Cat();
Cat cat2 = new Cat();
cat1.age=2;
cat1.weight=3;
cat1.strength=5;
cat2.age=4;
cat2.weight=4;
cat2.strength=5;
}
}