ricskooo

Untitled

Mar 2nd, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. package Person;
  2.  
  3. import Building.Room;
  4.  
  5. /**
  6. * Created by Ricsko on 2017. 03. 01..
  7. */
  8. public class Person {
  9.  
  10. private String name;
  11. private int age;
  12. private boolean isEmploy;
  13. private Room room;
  14.  
  15. public Person(String name, int age, boolean isEmploy) {
  16. this.name = name;
  17. this.age = ((age < 0)? age: 20);
  18. this.isEmploy = isEmploy;
  19. }
  20.  
  21. public void enterRoom(){
  22. room.addPerson(this);
  23. }
  24.  
  25. public void leaveRoom(){
  26. room.removePerson(this);
  27. }
  28.  
  29.  
  30. public void kiirPerson(){
  31. System.out.println(this);
  32. }
  33.  
  34. @Override
  35. public String toString() {
  36. return "Person{" +
  37. "name='" + name + '\'' +
  38. ", age=" + age +
  39. ", isEmploy=" + isEmploy +
  40. '}';
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment