Advertisement
KechevD

Lesson 23 Inheritage_DiscountTicket

May 18th, 2020
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. public class DiscountTicket extends Ticket {
  2.  
  3. String buyer;
  4.  
  5. public DiscountTicket(String performance, double price, String buyer) {
  6. super(performance, price / 2); //the price is 50% the original
  7. this.buyer = buyer;
  8. }
  9.  
  10. public String getBuyer() {
  11. return buyer;
  12. }
  13. public void setBuyer(String buyer) {
  14. this.buyer = buyer;
  15. }
  16.  
  17. @Override
  18. public String toString() {
  19. return "DiscountTicket [buyer=" + buyer + ", performance=" + performance + ", price=" + price + ", people="
  20. + people + "]";
  21. }
  22.  
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement