Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(1) The Movie, Ticket, Theatre and Patron Classes You will need to define 4 objects as indicated below. You must choose appropriate attribute names so
(1) The Movie, Ticket, Theatre and Patron Classes You will need to define 4 objects as indicated below. You must choose appropriate attribute names so that the test program that follows compiles and runs properly. Define a class called Movie that maintains the title of a movie as well as the amount of earnings it has made since it opened at the theatre . Define a class called Theatre that keeps track of the Movie object that is currently playing in that theatre. have been sold for the movie playing Define a class called Ticket that represents a ticket to go and watch a movie. only valid for a specific Theatre object. Define a class called Patron that keeps track of the age of a person as well as the Ticket object that he/she has purchased . A theatre should also have a seat capacity and keep track of how many seats . Each ticket is . Write any necessary code so that the following test program works as indicated in the output that follows public class TestProgram i public static void main (String args[]) I Movie m = new Movie ("Despicable Me 3"); System.out.println (m.title) System. out.println (m.earnings); Theatre theatre- new Theatre (3); System.out.println (theatre.capacity); System.out.println (theatre.seatsSold); theatre.moviePlaying-m; Patron mary = new Patron (15); System. out.println (mary.age) System.out.println (mary.ticket); mary.ticket- new Ticket (theatre); System. out.println (mary.ticket.theatre.moviePlaying. title); Despicable Me 3 0.0 The expected output is shown here on the right Make sure that your code works before you continue. 15 null Despicable Me 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started