Advertisement
aaronvan

revisedClass

May 1st, 2016
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. public class Ticket {
  2.  
  3.     private int ticketNumber;
  4.     double ticketPrice;
  5.    
  6.     // constructor for a new Ticket object
  7.     public Ticket(int ticketNumber) {
  8.         this.ticketNumber = ticketNumber;
  9.     }
  10.    
  11.     public double getPrice() {
  12.         return this.ticketPrice;
  13.     }
  14.    
  15.     public String toString() {
  16.         String ticket = "Number: " + ticketNumber + ", " + "Price: " + ticketPrice;
  17.         return ticket;
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement