SlideShare a Scribd company logo
Amusement Park Programming Project
Project Outcomes
1. Use the Java selection constructs (if and if else).
2. Use the Java iteration constructs (while, do, for).
3. Use Boolean variables and expressions to control iterations.
4. Use arrays or ArrayList for storing objects.
5. Proper design techniques.
Project Requirements
Your job is to implement a simple amusement park information
system that keeps track of admission tickets and merchandise in
the gift shop. The information system consists of three classes
including a class to model tickets, a class to model gift shop
merchandise, the amusement park, and the amusement park
tester. The gift shop supports access to specific merchandise in
the park’s gift shop and to purchase the merchandise or to order
new merchandise for the gift shop. The UML diagram for each
class (except the tester class) is given below.
1) Develop a simple class that models admission tickets. Each
admission is described by several instance fields:
a. A ticket number as a long integer to identify the unique
ticket,
b. A ticket category represented as a String to store the category
of the ticket (i.e. adult, child, senior),
c. A ticket holder represented as a String to store the name of
the person who purchased the ticket,
d. A date represented as a Date to store the admission date for
the ticket,
e. A price represented as a double to store the price of the
ticket,
f. A purchase status represented as a boolean to indicate if the
ticket has been purchased (or is reserved).
Ticket
-number : long
-category : String
-holder : String
-date : Date
-price : double
In addition to these fields, the class has the following
constructors and
methods:
a. A parameterized constructor that initializes the attributes of a
ticket.
b. setPrice(double price) to change the price of a textbook.
c. changePurchaseStatus(boolean newStatus) to change the
purchase status of the ticket.
d. Accessor methods for all instance fields.
e. toString() to return a neatly formatted string that contains all
the
information stored in the instance fields.
2) Develop a simple class that models merchandise available in
the gift shop
such as t-shirts, sweatshirts, and stuffed animals. The class has
several
instance fields:
a. An ID as a long integer to identify the specific merchandise
item,
b. A category as a String to store the specific type of
merchandise,
c. A description as a String to store the description of the
merchandise,
d. A price represented as a double to store the price of the
merchandise,
e. An instock as a boolean to indicate if the merchandise is
instock or onorder.
Valid values for category include "T-Shirt", "Sweatshirt", and
"Stuffed Animal",
as well as any additional category you choose to support. If
invalid values are
entered, an error message must be printed and the category
instance field
must be set to "UNKNOWN".
In addition to these attributes, the class has the following
constructors and
methods:
f. A parameterized constructor that initializes the attributes of a
merchandise item.
g. setPrice(double price) to change the price of the merchandise.
h. setInstock(boolean newStatus) to change the status of the
merchandise item.
i. Accessor methods for all instance fields.
j. toString() to return a neatly formatted string that contains all
the
information stored in the instance fields.
+Ticket (String, String, Date, double, boolean)
+setPrice(double)
+changePurchaseStatus(boolean)
+getNumber() : long
+getCategory() : String
+getHolder() : String
+getDate() : String
+getPrice() : double
+toString() : String
Merchandise
-id : long
-category : String
-description : String
-price : double
-inStock : boolean
+Merchandise(String, String, String, double, boolean)
+setPrice(double) +setInstock(boolean)
+getId() : String
+getCategory() : String
+getDescription() : String
+getPrice() : double
+getInstock() : boolean
+toString() : String
3) 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
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.
4) 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 AmusementPark and name it "Walden Amusement
Park".
b. Create a minimum of three Ticket 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 purchases.
ii. 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 ticket or merchandise
category, etc. You might want to use static methods in main() to
handle each 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.
Your program should handle input errors gracefully. For
example, if a particular ticket is searched and not found, the
program should display a message such as "Selected ticket not
found." Feel free to experiment with the tester program in order
to develop a more useful program.
Implementation Notes:
1) All accessor methods in AmusementPark must create a new
ArrayList to copy objects into the new list. This requires loops
to access objects from the corresponding instance fields and
adding them to the new ArrayList.
2) Proper error handling is essential for this project.
3) Javadoc must be used to document AmusementPark, Ticket,
and Merchandise.
Four files for this assignment:
a. Ticket.java - The Ticket class,
b. Merchandise.java - The Merchandise class,
c. AmusementPark.java - The AmusementPark class,
d. AmusementParkTester.java - A driver program for testing
your AmusementPark class.
Amusement Park Programming ProjectProject Outcomes1. Use the Jav.docx

More Related Content

DOCX
Resources the Final Project Overview and the Final Project Interv.docx
DOCX
© 2014 Laureate Education, Inc. Page 1 of 4 Retail Trans.docx
DOCX
I received answers to 2 App requests and paid. The JAVA Apps are not.docx
DOC
Csci 1101 computer science ii assignment 3/tutorialoutlet
PDF
PDF
ARabia hossain project report.pdf
DOCX
1- GivenaclassnamedTicketDB- whichwillbeusedtoprovidetheresponsibility.docx
PDF
Assignment in java
Resources the Final Project Overview and the Final Project Interv.docx
© 2014 Laureate Education, Inc. Page 1 of 4 Retail Trans.docx
I received answers to 2 App requests and paid. The JAVA Apps are not.docx
Csci 1101 computer science ii assignment 3/tutorialoutlet
ARabia hossain project report.pdf
1- GivenaclassnamedTicketDB- whichwillbeusedtoprovidetheresponsibility.docx
Assignment in java

Similar to Amusement Park Programming ProjectProject Outcomes1. Use the Jav.docx (20)

PDF
Hi could I get the java code for all the tasks pls, many thanks!.pdf
PDF
Section5 containment in unions and methods
DOCX
Question- Write the Java code below in IDE ECLIPSE enviroment and prov.docx
PDF
PDF
O flecture 03
PDF
A06
DOCX
Final report mobile shop
PDF
BELOW IS MY CODE FOR THIS ASSIGMENT BUT IT NOT WORKING WELL PLEASE H.pdf
DOCX
JAVA practical Exam Questions (1).docx
DOC
Java programming lab assignments
PPT
Book service
PDF
API Design
DOCX
In this project the students are supposed to develop a applica.docx
DOCX
1 – Implementing the Decorator Design Pattern (with St.docx
DOCX
DS Java semestre 1 2324 pour les ingénieurs
DOCX
Write a set of four classes- and one interface will be used in a medi.docx
DOCX
Write a set of four classes, and one interface will be used in a med.docx
PDF
In this assignment you will practice creating classes and enumeratio.pdf
PDF
Rich Internet Applications con JavaFX e NetBeans
DOC
Report in Java programming and SQL
Hi could I get the java code for all the tasks pls, many thanks!.pdf
Section5 containment in unions and methods
Question- Write the Java code below in IDE ECLIPSE enviroment and prov.docx
O flecture 03
A06
Final report mobile shop
BELOW IS MY CODE FOR THIS ASSIGMENT BUT IT NOT WORKING WELL PLEASE H.pdf
JAVA practical Exam Questions (1).docx
Java programming lab assignments
Book service
API Design
In this project the students are supposed to develop a applica.docx
1 – Implementing the Decorator Design Pattern (with St.docx
DS Java semestre 1 2324 pour les ingénieurs
Write a set of four classes- and one interface will be used in a medi.docx
Write a set of four classes, and one interface will be used in a med.docx
In this assignment you will practice creating classes and enumeratio.pdf
Rich Internet Applications con JavaFX e NetBeans
Report in Java programming and SQL
Ad

More from cullenrjzsme (20)

DOCX
Answer questions on the attached doc each answer must be minimum 250.docx
DOCX
Answer QuestionCompare and contrast the two types of totalitaria.docx
DOCX
Answer question in 8 or more sentences.1. In the colonial world,.docx
DOCX
Answer T for True or F for False (write clearly!)16._____.docx
DOCX
answer must begin as follows and have 4 points and 4 sourcesI agr.docx
DOCX
answer must begin as follows and have 4 points and 4 sourcesI a.docx
DOCX
answer must begin as follows and have 4 points and 4 sourcesI.docx
DOCX
Answer follow question1. Explain what sociologists mean by t.docx
DOCX
Answer each question with a high quality response. Please provide an.docx
DOCX
Answer each question fully. The finance department of a large co.docx
DOCX
Answer each part in essay format.Explain rights and procedures of .docx
DOCX
ANSWER QUESTIONCompare and contrast the personalities and polici.docx
DOCX
answer questions attached.. 21). Give the name, date, location o.docx
DOCX
Answer each of the following questions in regards to the two pieces .docx
DOCX
answer each with at least 100 words.PromptTopic Anton grew u.docx
DOCX
Answer each of the following 4 questions with a 3-5 sentence.docx
DOCX
Answer questions1. Describe various forms of internal and ext.docx
DOCX
Answer 5 question2 pagessingle space 12 font1.How do.docx
DOCX
Answer all three questions. Write 3 pages for each answer. 1.B.docx
DOCX
Answer both of the questions below 1.Discuss two differences i.docx
Answer questions on the attached doc each answer must be minimum 250.docx
Answer QuestionCompare and contrast the two types of totalitaria.docx
Answer question in 8 or more sentences.1. In the colonial world,.docx
Answer T for True or F for False (write clearly!)16._____.docx
answer must begin as follows and have 4 points and 4 sourcesI agr.docx
answer must begin as follows and have 4 points and 4 sourcesI a.docx
answer must begin as follows and have 4 points and 4 sourcesI.docx
Answer follow question1. Explain what sociologists mean by t.docx
Answer each question with a high quality response. Please provide an.docx
Answer each question fully. The finance department of a large co.docx
Answer each part in essay format.Explain rights and procedures of .docx
ANSWER QUESTIONCompare and contrast the personalities and polici.docx
answer questions attached.. 21). Give the name, date, location o.docx
Answer each of the following questions in regards to the two pieces .docx
answer each with at least 100 words.PromptTopic Anton grew u.docx
Answer each of the following 4 questions with a 3-5 sentence.docx
Answer questions1. Describe various forms of internal and ext.docx
Answer 5 question2 pagessingle space 12 font1.How do.docx
Answer all three questions. Write 3 pages for each answer. 1.B.docx
Answer both of the questions below 1.Discuss two differences i.docx
Ad

Recently uploaded (20)

PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Basic Mud Logging Guide for educational purpose
PPTX
Cell Types and Its function , kingdom of life
PPTX
Cell Structure & Organelles in detailed.
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Classroom Observation Tools for Teachers
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Institutional Correction lecture only . . .
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
RMMM.pdf make it easy to upload and study
Final Presentation General Medicine 03-08-2024.pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Supply Chain Operations Speaking Notes -ICLT Program
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Basic Mud Logging Guide for educational purpose
Cell Types and Its function , kingdom of life
Cell Structure & Organelles in detailed.
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
GDM (1) (1).pptx small presentation for students
Module 4: Burden of Disease Tutorial Slides S2 2025
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Classroom Observation Tools for Teachers
O5-L3 Freight Transport Ops (International) V1.pdf
Anesthesia in Laparoscopic Surgery in India
Institutional Correction lecture only . . .
TR - Agricultural Crops Production NC III.pdf
RMMM.pdf make it easy to upload and study

Amusement Park Programming ProjectProject Outcomes1. Use the Jav.docx

  • 1. Amusement Park Programming Project Project Outcomes 1. Use the Java selection constructs (if and if else). 2. Use the Java iteration constructs (while, do, for). 3. Use Boolean variables and expressions to control iterations. 4. Use arrays or ArrayList for storing objects. 5. Proper design techniques. Project Requirements Your job is to implement a simple amusement park information system that keeps track of admission tickets and merchandise in the gift shop. The information system consists of three classes including a class to model tickets, a class to model gift shop merchandise, the amusement park, and the amusement park tester. The gift shop supports access to specific merchandise in the park’s gift shop and to purchase the merchandise or to order new merchandise for the gift shop. The UML diagram for each class (except the tester class) is given below. 1) Develop a simple class that models admission tickets. Each admission is described by several instance fields: a. A ticket number as a long integer to identify the unique ticket, b. A ticket category represented as a String to store the category of the ticket (i.e. adult, child, senior), c. A ticket holder represented as a String to store the name of the person who purchased the ticket, d. A date represented as a Date to store the admission date for the ticket, e. A price represented as a double to store the price of the ticket, f. A purchase status represented as a boolean to indicate if the ticket has been purchased (or is reserved). Ticket -number : long -category : String -holder : String
  • 2. -date : Date -price : double In addition to these fields, the class has the following constructors and methods: a. A parameterized constructor that initializes the attributes of a ticket. b. setPrice(double price) to change the price of a textbook. c. changePurchaseStatus(boolean newStatus) to change the purchase status of the ticket. d. Accessor methods for all instance fields. e. toString() to return a neatly formatted string that contains all the information stored in the instance fields. 2) Develop a simple class that models merchandise available in the gift shop such as t-shirts, sweatshirts, and stuffed animals. The class has several instance fields: a. An ID as a long integer to identify the specific merchandise item, b. A category as a String to store the specific type of merchandise, c. A description as a String to store the description of the merchandise, d. A price represented as a double to store the price of the merchandise, e. An instock as a boolean to indicate if the merchandise is instock or onorder. Valid values for category include "T-Shirt", "Sweatshirt", and "Stuffed Animal", as well as any additional category you choose to support. If invalid values are entered, an error message must be printed and the category instance field must be set to "UNKNOWN".
  • 3. In addition to these attributes, the class has the following constructors and methods: f. A parameterized constructor that initializes the attributes of a merchandise item. g. setPrice(double price) to change the price of the merchandise. h. setInstock(boolean newStatus) to change the status of the merchandise item. i. Accessor methods for all instance fields. j. toString() to return a neatly formatted string that contains all the information stored in the instance fields. +Ticket (String, String, Date, double, boolean) +setPrice(double) +changePurchaseStatus(boolean) +getNumber() : long +getCategory() : String +getHolder() : String +getDate() : String +getPrice() : double +toString() : String Merchandise -id : long -category : String -description : String -price : double -inStock : boolean +Merchandise(String, String, String, double, boolean) +setPrice(double) +setInstock(boolean) +getId() : String +getCategory() : String +getDescription() : String +getPrice() : double +getInstock() : boolean +toString() : String 3) Develop class AmusementPark that keeps track of tickets and
  • 4. 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 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
  • 5. 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. 4) 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 AmusementPark and name it "Walden Amusement Park". b. Create a minimum of three Ticket 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
  • 6. merchandise or purchasing items. Use all of the accessor methods in the AmusementPark to access specific items. Use the given methods to make purchases. ii. 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 ticket or merchandise category, etc. You might want to use static methods in main() to handle each 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. Your program should handle input errors gracefully. For example, if a particular ticket is searched and not found, the program should display a message such as "Selected ticket not found." Feel free to experiment with the tester program in order to develop a more useful program. Implementation Notes: 1) All accessor methods in AmusementPark must create a new ArrayList to copy objects into the new list. This requires loops to access objects from the corresponding instance fields and adding them to the new ArrayList. 2) Proper error handling is essential for this project. 3) Javadoc must be used to document AmusementPark, Ticket, and Merchandise. Four files for this assignment: a. Ticket.java - The Ticket class, b. Merchandise.java - The Merchandise class, c. AmusementPark.java - The AmusementPark class, d. AmusementParkTester.java - A driver program for testing your AmusementPark class.