Package passport.domain.models.events
Class Ticket
java.lang.Object
passport.domain.models.events.Ticket
Represents a ticket for an event, including event ID, price, and
availability.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the number of persons the ticket is available for.copy()
Creates a copy of the current ticket.event()
Returns the event ID associated with the ticket.Creates a ticket for the specified number of persons.price()
Returns the total price of the ticket based on availability.boolean
Checks if the ticket is for the same event as another ticket.
-
Constructor Details
-
Ticket
-
Ticket
Constructs a new Ticket with the specified event ID and a default price of 0.0.- Parameters:
event
- the event ID
-
-
Method Details
-
copy
Creates a copy of the current ticket.- Returns:
- a new Ticket object that is a copy of the current ticket
-
packedFor
-
event
-
price
Returns the total price of the ticket based on availability.- Returns:
- the total price
-
availableFor
Returns the number of persons the ticket is available for.- Returns:
- the number of available persons
-
sameEvent
Checks if the ticket is for the same event as another ticket.- Parameters:
other
- the other ticket to compare- Returns:
- true if the tickets are for the same event, false otherwise
-