Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package items;
- import textgame.UserInterface;
- /**
- * Trieda reprezentujuca predmet Truhlica
- */
- public class Truhlica extends AbstractItem implements Openable{
- private boolean opened;
- /**
- * Konstruktor triedy
- */
- public Truhlica(){
- super("Truhlica", "Mohutna plastova truhlica skryva urcite nieco zaujimave");
- }
- public boolean isOpen() {
- if(opened==true)
- return true;
- else
- return false;
- }
- public void open(UserInterface ui) {
- if(isOpen())
- ui.println("uz je otvorena");
- else
- this.open(this.opened);
- }
- public void close(UserInterface ui) {
- if(!isOpen())
- ui.println("uz je zavreta stary");
- else
- this.close(this.opened);
- }
Add Comment
Please, Sign In to add comment