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 tage,tweight,tstrength,aage,aweight,astrenght;
boolean result;
tage = this.age;
tweight = this.weight;
tstrength = this.strength;
aage = anotherCat.age;
aweight = anotherCat.weight;
astrenght = anotherCat.strength;
if (((tage > aage)&&(tweight > aweight)&&(tstrength > astrenght)) ||
((tage > aage)&&(tweight > aweight)&&(tstrength < astrenght)) ||
((tage > aage)&&(tweight < aweight)&&(tstrength > astrenght)) ||
((tage < aage)&&(tweight > aweight)&&(tstrength > astrenght))) {result = true; }
else {result = false; }
return result;
}
public static void main(String[] args) {
Cat cat1 = new Cat();
Cat cat2 = new Cat();
cat1.fight(cat2);
}
}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 tage,tweight,tstrength,aage,aweight,astrenght;
boolean result;
tage = this.age;
tweight = this.weight;
tstrength = this.strength;
aage = anotherCat.age;
aweight = anotherCat.weight;
astrenght = anotherCat.strength;
if (((tage > aage)&&(tweight > aweight)&&(tstrength > astrenght)) ||
((tage > aage)&&(tweight > aweight)&&(tstrength < astrenght)) ||
((tage > aage)&&(tweight < aweight)&&(tstrength > astrenght)) ||
((tage < aage)&&(tweight > aweight)&&(tstrength > astrenght))) {result = true; }
else {result = false; }
return result;
}
public static void main(String[] args) {
Cat cat1 = new Cat();
Cat cat2 = new Cat();
cat1.fight(cat2);
}
}