Java - How can objects have other objects?

Caporegime
Joined
12 Mar 2004
Posts
29,962
Location
England
Java - object interaction

How would I be able to say create many ticket machines, each with many tickets that can be chosen?

I've created the classes "TicketMachine" and "Ticket". I want the ticketmachine to be able to work out if the customers puts enough money in for a ticket but to do that they need to be able to select what ticket they want, and then the ticketmachine needs to get the tickets price from the ticket object.
 
Last edited:
Back
Top Bottom