Advertisement
KechevD

Lesson 23 Inheritage_Ticket

May 18th, 2020
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. public class Ticket {
  2.  
  3. String performance;
  4. double price;
  5. int people;
  6.  
  7. public Ticket(String performance, double price) {
  8. this(performance, price, 1); //one person by default
  9. }
  10. public Ticket(String performance, double price, int people) {
  11. this.performance = performance;
  12. this.price = price;
  13. this.people = people;
  14. }
  15.  
  16. public String getPerformance() {
  17. return performance;
  18. }
  19. public void setPerformance(String performance) {
  20. this.performance = performance;
  21. }
  22. public double getPrice() {
  23. return price;
  24. }
  25. public void setPrice(double price) {
  26. this.price = price;
  27. }
  28. public int getPeople() {
  29. return people;
  30. }
  31. public void setPeople(int people) {
  32. this.people = people;
  33. }
  34. @Override
  35. public String toString() {
  36. return "Ticket [performance=" + performance + ", price=" + price + ", people=" + people + "]";
  37. }
  38.  
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement