Exemple #1
0
 public Cat fight(Cat enemy) {
   if (this.isSex() == enemy.isSex()) {
     if (this.getWeight() < enemy.getWeight()) {
       return enemy;
     }
     if (this.getWeight() > enemy.getWeight()) {
       return this;
     }
     if (this.getWeight() == enemy.getWeight()) {
       return new Cat("Equal warriors", null, 0, 0, false);
     }
   }
   return new Cat("❤❤❤ Make love not war ❤❤❤", null, 0, 0, false);
 }
Exemple #2
0
  public Cat makeLove(Cat anotherCat) {
    Random rn = new Random();
    if (this.isSex() != anotherCat.isSex())
      return new Cat("noname", "white", 0, 0, rn.nextBoolean());

    return null;
  }