Question: For the Ticket class: 1 . Don t allow the ticket class to be instantiated. 2 . Add an event date field. 3 . The
For the Ticket class: Dont allow the ticket class to be instantiated. Add an event date field. The price field is a private constant and is the default ticket price. The number field is static not constant initialized to and is the last ticket number generated. Ticket numbers should be alphas you choose plus digits that increase with each ticket determined using number For example: GSU Create a stub method that handles payments by excepting an amount field and returning a Boolean value to indicate that the payment was accepted. a A stub method is a method that serves as a placeholder for code that can be added at a later date. It just takes in parameters and issues a response. b Issue an appropriate message that payment was accepted for the dollar amount passed. c Return a true response from the method. d Allow this class to be called from a subclass only. Allow toString to use a default parameter or accept amount as a parameter. a Print: event date, ticket number and amount. eg Number: GSU Price: $ CPSC Exercise Ex For the Walkup Ticket class: Override toString method to print the ticket type before calling the superclass toString method. Allow printing on the same line. eg Walkup Ticket Number: GSU Price: $ For the Advanced Ticket class: Override getPrice to get the default price via the super getPrice and calculate the price to be discounted for purchases days or more before the event and discounted for those less than days before the event. Override toString method to print the ticket type before calling the superclass toString method. Allow printing on the same line. eg Advanced Ticket Number: GSU Price: $ For the Student Advanced Ticket class: Override getPrice to get the advanced ticket price via the super getPrice and calculate the price to be half the advanced ticket price. Override toString method to print Student before calling the superclass toString method. Allow printing on the same line. eg Student Advanced Ticket Number: GSU Price: $ CPSC Exercise Ex From the main method: Define objects for the three ticket subclasses. Prompt the user for the event date that they are purchasing a ticket for a Research how to work with dates in java ie read in store, compare, calculate days between dates, current date Prompt the user to ask if they are a student. Based on user input, determine the ticket object to use. a Get the price of the ticket b Get payment c If payment is good i Get ticket ii Print ticket Continue to prompt the user to purchase tickets until the user quits using a sentinel value
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
