How can I print the result of the fights? I tried many variations, nothing works :(
package pl.codegym.task.task05.task0505;
/*
Kocia jatka
*/
import org.w3c.dom.ls.LSOutput;
import java.sql.SQLOutput;
public class Solution {
public static void main(String[] args) {
Kot kot1 = new Kot("Burek", 34, 54, 65);
Kot kot2 = new Kot("Szybki", 3, 43, 22);
Kot kot3 = new Kot("Lekki", 33, 52, 99);
kot1.walka(kot2);
kot2.walka(kot3);
kot1.walka(kot3);
//tutaj wpisz swój kod
}
public static class Kot {
protected String imie;
protected int wiek;
protected int waga;
protected int sila;
public Kot(String imie, int wiek, int waga, int sila) {
this.imie = imie;
this.wiek = wiek;
this.waga = waga;
this.sila = sila;
}
public boolean walka(Kot innyKot) {
int wiekPrzewaga = this.wiek > innyKot.wiek ? 1 : 0;
int wagaPrzewaga = this.waga > innyKot.waga ? 1 : 0;
int silaPrzewaga = this.sila > innyKot.sila ? 1 : 0;
int wynik = wiekPrzewaga + wagaPrzewaga + silaPrzewaga;
return wynik > 2; // return wynik > 2 ? true : false;
}
}
}