Facebook
From Funky Lizard, 7 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 349
  1.  
  2. package javaapplication1;
  3.  
  4. import java.util.Random;
  5.  
  6.  
  7. public class Galaxy extends Statek {
  8.     public Galaxy(String mNazwa, int stan) {
  9.         super(mNazwa, stan);
  10.     }
  11.    
  12.     public void wyswietl(){
  13.         String stany = stan == 1 ? "Sprawny" : "Niesprawny";
  14.         System.out.println("Galaxy " + mNazwa);
  15.         System.out.println("Stan: " + stany);
  16.     }
  17.    
  18.    
  19.    
  20.     public void bronsie(Statek oponent){
  21.         if(this.stan == 1){
  22.             System.out.println(this.getClass().getSimpleName() + mNazwa + "Broni sie");
  23.             Random r = new Random();
  24.             int wynik = r.nextInt(2);
  25.             oponent.ustawStan(0);
  26.         }
  27.     }
  28. }