package javaapplication1; import java.util.Random; public class Statek { public final int SPRAWNY = 1; public final int NIESPRAWNY = 0; protected String mNazwa; protected int stan; public Statek(String mNazwa, int stan) { this.mNazwa = mNazwa; this.stan = stan; } public void wyswietl(){ String stany = stan == 1 ? "Sprawny" : "Niesprawny"; System.out.println("Statek " + mNazwa); System.out.println("Stan: " + stany); } public void bronsie(Statek oponent){ if(this.stan == 1){ Random r = new Random(); int wynik = r.nextInt(2); oponent.ustawStan(0); } } public void ustawStan(int stan){ this.stan = stan; } public int dajStan(){ return this.stan; } }