Design class hierarchy that encompasses the another classes

Assignment Help Basic Computer Science
Reference no: EM131661961

Question: 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.

2182_4.png

c. Implement the Fixed PriceTicket 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 WalkupTicket class and the ComplementaryTicket class.

e. Implement the AdvanceTicket 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 StudentAdvanceTicket 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 AdvanceTicket changes, the StudentAdvanceTicket price should be computed correctly with no code modification to the StudentAdvanceTicket 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.

Reference no: EM131661961

Questions Cloud

Discuss the key features of organisational policy : Briefly identify and discuss the key features of organisational policy and procedures as they apply to costing systems
Prepare diana healthy journal entries : Prepare Diana Healthy journal entries relating to the above donation by Aron Enterprises - describe how Diana Healthy should record it under the restricted fund
Examine trends over time or to compare the rates : examine trends over time or to compare the rates in different countries. It is quite a different thing to develop explanations
The creation of teen idols is a tradition : What were some of the factors that led to this point in the early 60's? Is it still prevalent? If so, why? Name some examples.
Design class hierarchy that encompasses the another classes : Implement the Ticket abstract class. This class should store a serial number as its private data.
Discuss about the cultural relativism : Describe the challenges they present and what problems of logic they encounter. How does each of these theories challenge the MCM?
Discuss self-care with this side-effect of chemo : What questions would the nurse ask the patient as part of her health assessment in regards to her health assessment
List the system requirements with examples for each category : List the system requirements, with examples for each category. If Susan wants to conduct a survey of current or prospective members to obtain their input.
Determine the company preliminary net income : Paid wages of $1,550 for the current period (example). Purchased $3,100 of equipment on credit. Determine the company's preliminary net income

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Automata theory, grammars and languages ip

Task Background: This assignment involves solving problems by using various discrete techniques to model the problems at hand. Quite often, these models form the foundations for writing computer programming code that automate the tasks. To carry ..

  What is the output of this code sequence

What is the output of this code sequence

  When is the output of a plc counter energized

The counter instructions of PLCs are normally retentive. Explain what this means.

  Design and implement a dhcp solution

As a system administrator at Adatum Inc., a small company that has about 25 employees. You have 3 servers and 25 workstations to manage. Design and implement a DHCP solution for your company using Windows Server 2012 R2 that meet these requirement..

  Explain cost and scope in procurement management section

Please review the attached paper and make necessary corrections. Additionally please include triple threat items - time, cost and scope in Procurement Management section in following sections

  How do the results of parsing two sentences differ

How do the results of parsing the following two sentences differ? How do the results of semantic analysis differ? If X 10 then add 1 to X else subtract 1 from X.

  Knowledge of two dierent ciphertext sequences

Explain how only the knowledge of two dierent ciphertext sequences C = C1C2 Cn and C0 = C01 C02 C0n, obtained by applying the same secret key, can compromise the security of the system.

  Levels of certainty associated with digital evidence

Some experts say the following, "the field of digital forensics does not currently have formal mathematics or statistics to evaluate levels.

  Follow the steps below

Follow the steps below. If you make an error, use the UNDO button to undo the error.

  Company improve its customer service relations

What strategies does the company use to meet customer expectations? Based on what you learned in this lesson, how can the company improve its customer service.

  Explain why no such fixes are possible

explain why no such fixes are possible.

  Standard form of the equation of a circle

When writing the standard form of the equation of a circle how do you determine the radius with the given information

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd