logic
package com.codegym.task.task05.task0502;
/*
Implement the fight method
*/
public class Cat {
public int age;
public int weight;
public int strength;
public int point=0;
public Cat() {
this.age = age;
this.weight = weight;
this.strength = strength;
}
public boolean fight(Cat anotherCat) {
//write your code here
if(this.age>=anotherCat.age)
point++;
else if(this.weight<=anotherCat.weight)
point++;
else if(this.strength>=anotherCat.strength)
point++;
if(this.point >= anotherCat.point)
return true;
else
return false;
}
public static void main(String[] args) {
Cat cat1=new Cat();
cat1.age=5;
cat1.weight=15;
cat1.strength=75;
Cat cat2=new Cat();
cat2.age=6;
cat2.weight=20;
cat2.strength=120;
System.out.println(cat1.fight(cat2));
System.out.println(cat2.fight(cat1));
}
}