Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with writing this i don't know where to start or even really what to do if i could get some help with

I need help with writing this i don't know where to start or even really what to do if i could get some help with writting this with explanations i would greatly apprciate it. This has to be written in Java please and thank youimage text in transcribedimage text in transcribedimage text in transcribed

A set of classes is used to handle the different ticket types for a theater. All tickets have a unique serial number that is assigned when the ticket is constructed and a price. There are many types of tickets. a. Design a class hierarchy that encompasses the above three classes. b. Implement the Ticket abstract class. This class should store a serial number as its private data. Provide an appropriate abstract method to get the price of the ticket, provide a method that returns the serial number, and provide an implementation of toString that prints the serial number and price information. The Ticket class must provide a constructor to initialize the serial number. To do so, use the following strategy: maintain a static ArrayList representing previously assigned serial numbers. Repeatedly generate a new serial number using a random number generator until you obtain a serial number not already assigned. Sample toString Output Description Ticket type This is an abstract class representing all tickets Ticket FixedPriceTicket This is an abstract class representing tickets that are always the same price. The constructor accepts the price as the parameter. SN: 273, $0 SN: 314, $50 These tickets are free (thus FixedPrice). These tickets are purchased on the day of the event for $50 (thus FixedPrice). ComplimentaryTicket WalkupTicket SN: 612, $40 Advance Ticket Tickets purchased ten or more days in advance cost $30. Tickets purchased fewer than ten days in advance cost $40. StudentAdvanceTicket These are AdvanceTickets that cost half of what an AdvanceTicket would normally cost. SN: 59, $15 (student) c. Implement the FixedPrice Ticket class. The constructor accepts a price. The class is abstract but you can and should implement the method that returns the price information. d. Implement the Walkup Ticket class and the ComplementaryTicket class. e. Implement the Advance Ticket class. Provide a constructor that takes a parameter indicating the number of days in advance that the ticket is being purchased. Recall that the number of days of advanced purchase affects the ticket price. f. Implement the StudentAdvance Ticket class. Provide a constructor that takes a parameter indicating the number of days in advance that the ticket is being purchased. The toString method should include a notation that this is a student ticket. This ticket costs half of an Advanceticket. If the pricing scheme for Advance Ticket changes, the StudentAdvance Ticket price should be computed correctly with no code modification to the StudentAdvance Ticket class. g. Write a class TicketOrder that stores a collection of Tickets. TicketOrder should provide methods add, toString, and totalPrice. Provide a test program that creates a TicketOrder object and then calls add with all kinds of tickets. Print the order, including the total price

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications Dexa 2022 Workshops 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 In Computer And Information Science 33

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Alfred Taudes ,Atif Mashkoor ,Johannes Sametinger ,Jorge Martinez-Gil ,Florian Sobieczky ,Lukas Fischer ,Rudolf Ramler ,Maqbool Khan ,Gerald Czech

1st Edition

3031143426, 978-3031143427

More Books

Students also viewed these Databases questions