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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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