Guest User

Untitled

a guest
May 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. package items;
  2.  
  3. import textgame.UserInterface;
  4.  
  5. /**
  6. * Trieda reprezentujuca predmet Truhlica
  7. */
  8. public class Truhlica extends AbstractItem implements Openable{
  9.  
  10. private boolean opened;
  11.  
  12. /**
  13. * Konstruktor triedy
  14. */
  15. public Truhlica(){
  16. super("Truhlica", "Mohutna plastova truhlica skryva urcite nieco zaujimave");
  17. }
  18.  
  19. public boolean isOpen() {
  20. if(opened==true)
  21. return true;
  22. else
  23. return false;
  24. }
  25.  
  26. public void open(UserInterface ui) {
  27. if(isOpen())
  28. ui.println("uz je otvorena");
  29. else
  30. this.open(this.opened);
  31. }
  32.  
  33. public void close(UserInterface ui) {
  34. if(!isOpen())
  35. ui.println("uz je zavreta stary");
  36. else
  37. this.close(this.opened);
  38. }
Add Comment
Please, Sign In to add comment