Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a java class that adheres to the following criteria: Create a class called MovieTicket that will serve as a blueprint for a movie ticket.
Write a java class that adheres to the following criteria:
- Create a class called MovieTicket that will serve as a blueprint for a movie ticket. (therefore contains no main method).
- This class should have:
- The following State: movie name, ticket number, theatre number
- Setters and getters for each instance variable
- A static variable called ticketPrice with a hardcoded initial value.
- A static method which calculates and returns the tax $ amount on the ticket price (assume 13% tax).
- Two non-static overloaded methods which will return the movie run dates, one based upon the movies main actor and one based upon the start time , (use a 24 hour clock as an int for the start time). Use the switch statement to hardcode 4 different options for each method based upon data you make up.
- Create a second class called MovieTicketTestHarness which contains a main method to test the first class:
- Note: Any interaction with the user must be accompanied with an appropriate message.
- Instantiate a ticket.
- Capture information from the user, and use the setters to populate all of the non-static fields of the ticket.
- Print out all the fields of the ticket plus the price of the ticket and the tax portion of the ticket.
- Ask the user for a movie main actor, use the appropriate method to determine and print the movie run dates.
- Ask the user for a start time, use the appropriate method to determine and print the movie run dates.
- Note: Any interaction with the user must be accompanied with an appropriate message.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Heres the implementation of the MovieTicket class and the MovieTicketTestHarness class in Java based on the provided criteria java import javautilScanner class MovieTicket private String movieName pri...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