how to realize 6th requirement.
package com.codegym.task.task05.task0502;
/*
Implement the fight method
*/
import java.io.*;
public class Cat {
public int age;
public int weight;
public int strength;
public Cat() {
}
public boolean fight(Cat anotherCat) {
if(this.strength>strength||this.age<age||this.weight>weight)
{
return true;
}
else if(this.strength == strength&&this.age==age&&this.weight == weight)
{
if(fight(this)== false)
return true;
else
return false;
}
else
return false;
}
public static void main(String[] args) {
Cat cat1 = new Cat();
cat1.age =2;
cat1.weight = 25;
cat1.strength = 12;
Cat cat2 = new Cat();
cat2.age =2;
cat2.weight = 25;
cat2.strength = 12;
Cat cat3 = new Cat();
cat3.age = 3;
cat3.weight = 15;
cat3.strength = 5;
cat1.fight(cat2);
cat1.fight(cat3);
cat2.fight(cat1);
}
}