question archive Project Outcomes 1
Subject:Computer SciencePrice: Bought3
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.
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.