Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. package com.sagwangho;
  2.  
  3. public class Audience {
  4. private Ticket ticket = Ticket.EMPTY;
  5. private Invitation invitation = Invitation.EMPTY;
  6. private Long amount;
  7.  
  8. public Audience(Long amount) {
  9. this.amount = amount;
  10. }
  11.  
  12. public void buyTicket(TicketSeller seller, Movie movie) {
  13. ticket = seller.getTicket(this, movie);
  14. }
  15.  
  16. public boolean hasAmount(Long amount) {
  17. return this.amount >= amount;
  18. }
  19.  
  20. public boolean minusAmount(Long price) {
  21. if (amount > this.amount) return false;
  22. this.amount -= amount;
  23. return true;
  24. }
  25.  
  26. public Invitation getInvitation() {
  27. return invitation;
  28. }
  29.  
  30. public void setInvitation(Invitation invitation) {
  31. this.invitation = invitation;
  32. }
  33.  
  34. public void removeInvitation() {
  35. this.invitation = Invitation.EMPTY;
  36. }
  37.  
  38. public Ticket getTicket() {
  39. return this.ticket;
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement