Write a java class that adheres to the following criteria: Create a class called MovieTicket that will
Fantastic news! We've Found the answer you've been seeking!
Question:
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.
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date: