Facebook
From Capacious Motmot, 7 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 273
  1. package com.company;
  2.  
  3. /**
  4.  * Created by Mazek on 2016-06-10.
  5.  */
  6. public abstract class Zwierze {
  7.     private String mImie;
  8.     protected int mGlod;
  9.     protected int mPragnienie;
  10.     protected int mZmeczenie;
  11.     protected int mHumor;
  12.  
  13.     public Zwierze(String mImie) {
  14.         this.mImie = mImie;
  15.         this.mGlod = 0;
  16.         this.mPragnienie = 0;
  17.         this.mZmeczenie = 0;
  18.         this.mHumor = 0;
  19.     }
  20.  
  21.     public void jedz(int iloscpozywienia) {
  22.         mGlod -= iloscpozywienia;
  23.     }
  24.  
  25.     public void pij(int iloscWody) {
  26.         mPragnienie -= iloscWody;
  27.     }
  28.  
  29.     public void spij(int czas) {
  30.         mZmeczenie -= czas;
  31.     }
  32.  
  33.     public abstract void bawSie(int czas);
  34.  
  35.     public void ustawImie(String mImie) {
  36.         this.mImie = mImie;
  37.     }
  38.  
  39.     public String naLancuch() {
  40.         return  dajRodajZwierzecia() + " " + mImie + "\n"
  41.                 + "Głód " + mGlod + "\n"
  42.                 + "Pragnienie    " + mPragnienie + "\n"
  43.                 + "Zmeczenie    " + mZmeczenie + "\n"
  44.                 + "Humor    " + mHumor;
  45.     }
  46.  
  47.     public String dajRodajZwierzecia(){
  48.         return this.getClass().getSimpleName() + ": ";
  49.     }
  50. }