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: 1. Dont allow the ticket class to be instantiated. 2. Add an event date field. 3. The price field is a private constant and is the default ticket price. 4. The number field is static (not constant), initialized to 0, and is the last ticket number generated. 5. Ticket numbers should be 3 alphas (you choose) plus 5 digits that increase with each ticket (determined using number). For example: GSU00001.6. 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. 7. Allow toString() to use a default parameter or accept amount as a parameter. a. Print: event date, ticket number and amount. e.g.04/05/2024 Number: GSU00001, Price: $50.00 CPSC-3148 Exercise Ex9.5-8 For the Walkup Ticket class: 1. Override toString() method to print the ticket type before calling the superclass toString() method. Allow printing on the same line. e.g. Walkup Ticket -04/05/2024 Number: GSU00001, Price: $50.00 For the Advanced Ticket class: 1. Override getPrice() to get the default price (via the super getPrice) and calculate the price to be 40% discounted for purchases 10 days or more before the event and 20% discounted for those less than 10 days before the event. 2. Override toString() method to print the ticket type before calling the superclass toString() method. Allow printing on the same line. e.g. Advanced Ticket -04/05/2024 Number: GSU00001, Price: $40.00 For the Student Advanced Ticket class: 1. Override getPrice() to get the advanced ticket price (via the super getPrice) and calculate the price to be half the advanced ticket price. 2. Override toString() method to print Student before calling the superclass toString() method. Allow printing on the same line. e.g. Student Advanced Ticket -04/05/2024 Number: GSU00001, Price: $20.00 CPSC-3148 Exercise Ex9.5-8 From the main method: 1. Define objects for the three ticket subclasses. 2. Prompt the user for the event date that they are purchasing a ticket for a. Research how to work with dates in java (i.e. read in, store, compare, calculate days between dates, current date).3. Prompt the user to ask if they are a student. 4. 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 5. 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!