Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

Question: Develop class AmusementPark that keeps track of tickets and gift shop inventory. The AmusementPark uses two ArrayLists to store Ticket and Merchandise objects. The AmusementPark provides several methods to add merchandise to the gift shop and to access merchandise. The following

UML diagram describes the class, the constructor, and the methods:

AmusementPark

-tickets : ArrayList

-merchandise : ArrayList

-name : String

+AmusementPark(String)

+getName() : String

+getTicketDates() : ArrayList

+getTickets(Date date) : int

+getTicket(long id) : Ticket

+getMerchandise() : ArrayList

+getMerchandise(String category) : ArrayList

+getMerchandise(long id) : Merchandise

+addTicket(Ticket)

+addMerchandise(Merchandise)

+buyMerchandise(String id)

+buyTicket(String id)

a. The class has three instance fields:

a. name, the name of the bookstore

b. tickets, an ArrayList storing Ticket objects © 2014 Laureate Education, Inc. Page 4 of 5

c. merchandise, an ArrayList storing Merchandise objects

b. getName() returns the name of the bookstore.

c. getTicketDates() returns an ArrayList of all the dates for which tickets are still available. If there are no tickets available, an empty list is returned.

d. getTickets (Date date) returns an integer indicating the number of tickets available for the specified date.

e. getTicket(long id) returns the Ticket that matches the specified id. If there is no Ticket matching the given id, null is
returned.

f. getMerchandise()returns an ArrayList of all the inventory (in-stock and ordered). This method must create a separate copy of the ArrayList before it returns the list. If there are no merchandise items in the AmusementPark, an empty list is returned.

g. getMerchandise(String category) returns a list of Merchandise objects whose category matches the specified category. For example, if called with "T-shirt" the method returns all Merchandise objects with the category "T-shirt" as a new list. This method must create a new copy of an ArrayList that stores all the matched Merchandise objects. If no items in the AmusementPark match the given name, an empty list is returned.

h. getMerchandise(long id) returns the merchandise item that matches the specified id. If there is no merchandise item matching the
given id, null is returned.

i. addTicket(Ticket) adds a new Ticket to the inventory of the AmusementPark.

j. addMerchandise(Merchandise) adds a new Merchandise to the inventory of the AmusementPark.

k. buyMerchandise(String id) removes a Merchandise object from the list of merchandise of the AmusementPark. If the id does not match any Merchandise object in the list, an exception is thrown.

l. buyTicket(String id) removes a Ticket object from the list of ticket items of the AmusementPark. If the id does not match any Ticket object in the list, an exception is thrown.

Design a tester class called AmusementParkTester. The tester class has a main() method and tests the functionality of the class AmusementPark as follows:a. Create an AmusementPark b. create a minimum of three tickets objects and add them to the bookstore.c. create apparel objects at least two of each category and add them to the AmusementPark.d. set up a loop to I Display a short menu that allows a user to perform different actions in the gift shop such as looking up tickets or merchandise or purchasing items. Use all of the accessor methods in the AmusementPark to access specific items. Use the given methods to make purchasesii. Prompt the user for a specific action.iii. Depending on the specific action prompt the user for additional input such as the id of a ticker tor mechandise category, etc. You might want to use static methods in main() to handle ach menu item separately.iv. Perform the action and display results such as the list of merchandise that the user has requested. Use the toString() method to display AmusementPark items on the screen.v. Prompt the user for continued access to the AmusementPark or to end the program.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M92285294
  • Price:- $55

Guranteed 36 Hours Delivery, In Price:- $55

Have any Question?


Related Questions in Programming Language

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

Task - hand execution of arraysoverviewin this task you

Task - Hand Execution of Arrays Overview In this task you will demonstrate how arrays work by hand executing a number of small code snippets. Instructions Watch the Hand Execution with Arrays video, this shows how to ste ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

Php amp session managment assignment -this assignment looks

PHP & SESSION MANAGMENT ASSIGNMENT - This assignment looks at using PHP for creating cookies and session management. Class Exercise - Web Project: Member Registration/Login This exercise will cover adding data connectivi ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As