строка 33
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)
{
int winRate1 = 0;
int winRate2 = 0;
if (this.weight>anotherCat.weight) {winRate1++;}
else if (this.weight<anotherCat.weight) {winRate2++;}
else if (this.weight==anotherCat.weight) {winRate1++; winRate2++;}
if (this.age>anotherCat.age) {winRate1++;}
else if (this.age<anotherCat.age) {winRate2++;}
else if (this.age==anotherCat.age) {winRate1++; winRate2++;}
if (this.strength>anotherCat.strength) {winRate1++;}
else if (this.strength<anotherCat.strength) {winRate2++;}
else if (this.strength==anotherCat.strength) {winRate1++; winRate2++;}
if (winRate1>0)
{return true;}
else if (winRate2>0)
{return false;}
else if (winRate1==winRate2)
{return false;}
}
public static void main(String[] args)
{
Cat cat1 = new Cat();
cat1.weight = 2;
cat1.age = 3;
cat1.strength = 4;
Cat cat2 = new Cat();
cat2.weight = 5;
cat2.age = 6;
cat2.strength = 7;
System.out.println(cat1.fight(cat2));
System.out.println(cat2.fight(cat1));
}
}