Please help
package com.codegym.task.task05.task0502;
/*
Implement the fight method
if cat1.fight(cat2) returns true,
then cat2.fight(cat1) must return false
*/
public class Cat {
public double age;
public double weight;
public double strength;
public double tpoints;
boolean lucky = true;
public Cat() {
}
public boolean fight(Cat anotherCat) {
if (this.tpoints > anotherCat.tpoints) {
return true;
} else if (this.tpoints == anotherCat.tpoints && this.lucky && !anotherCat.lucky) {
return true;
} else if (this.tpoints == anotherCat.tpoints && !this.lucky && anotherCat.lucky) {
this.lucky = false;
return false;
} else
return false;
}
public static void main(String[] args) {
Cat cat1 = new Cat();
Cat cat2 = new Cat();
cat1.weight = 6;
cat1.age = 6;
cat1.strength = 6;
cat1.tpoints = (cat1.age * 0.6) + (cat1.weight * 0.2) + (cat1.strength * 0.2);
cat2.weight = 5;
cat2.age = 5;
cat2.strength = 5;
cat2.tpoints = (cat2.age * 0.6) + (cat2.weight * 0.2) + (cat2.strength * 0.2);
/*System.out.println("Cat1 fight cat2. Win: "+cat1.fight(cat2));
System.out.println("Cat1 tpoints: "+cat1.tpoints);
System.out.println("cat1 lucky: "+cat1.lucky);
System.out.println("Cat2 fight cat1. Win: "+cat2.fight(cat1));
System.out.println("Cat2 tpoints: "+cat2.tpoints);
System.out.println("cat2 lucky: "+cat2.lucky);
System.out.println(cat2.fight(cat1));
System.out.println(cat1.fight(cat2));
System.out.println(cat2.fight(cat1));
System.out.println(cat1.fight(cat2));
*/
System.out.println(cat1.fight(cat2));
System.out.println(cat2.fight(cat1));
}
}