Overview:
BeRewarded is a company that runs a rewards program for their customers. When customers
purchase items they earn rewards points. Customers can then use these points to redeem gifts.
BeRewarded are planning to release a new version of software to provide this functionality and
you have been hired to write it in Java.
Below are the requirements of the software:
Getting Started:
1. Create a new project in BlueJ called Assignment1. All classes for the assignment are to be
saved in this project.
2. Create the required classes for the project - there should be at least three (3) classes:
Customer, Item and Gift. You can have any number of additional classes you think are
required.
3. Class basics:
Customer – a customer has a name and email address. They also have a points balance,
cash balance and totals for the number of items that have been purchased and redeemed.
Item – an item is something a customer can purchase. It has a name, description, price and
availability. It also has an attribute for the number of bonus points a customer can earn (see
below for more details)
Gift – a gift is something a customer can redeem. It has a name, description and
availability. It also has a points value i.e. a customer must have this number of points to be
able to redeem it (see below)
4. Constructors: all classes must have at least 1 alternate constructor that accepts input
parameters used to initialise the class attributes (done in the body of the constructor).
Functionality:
The software must provide these functions:
- Update (change) the price, description, availability and bonus points for an Item
- Update (change) the description, availability and points for a Gift
- Update (change) the email address, points balance and cash balance for a Customer
- Update (change) the total number of items purchased and the total number of
redemptions for a Customer
- Calculate the points value for an Item
- Customers can purchase an Item
- Customers can redeem gifts
- Report on which customers are VIP customers
NOTE: It is expected that if an error occurs e.g. if a customer does not have enough money to
purchase an item, then the system will display an appropriate error message. This applies for all
common errors.
Detailed Functionality:
1. Update (change) the price, description, availability and bonus points for an Item
It must be possible to update the price, description, availability and bonus points for an
Item. This should be done in four separate methods.
2. Update (change) the description, availability and points for a Gift
It must be possible to update the description, availability and points for a Gift. This should
be done in three separate methods.
3. Update (change) the email address, points balance and cash balance for a Customer
It must be possible to update the email address, points balance and cash balance for a
Customer. This should be done in three separate methods.
4. Update (change) the total number of items purchased and the total number of redemptions
for a Customer
It must be possible to update the total number of items purchased, and the total number of
redemptions. This should be done in two separate methods.
5. Calculate points value for an Item
Reward points are allocated to a customer when they purchase an item. The number of
points depends on the price of the item according to the following rules:
$0.01 - $9.99 = 1 point
$10.00 - $19.99 = 3 points
$20.00 - $49.99 = 6 points
$50.00 and over = 9 points
The method to calculate this should be part of the Item class.
6. Purchase an Item
Customers can purchase an item if they have enough cash and the item is available. If the
purchase is successful the points value of the item (this is a calculated value) is added to
the points balance for the customer. The price of the item must be deducted from the cash
balance for the customer. The total number of items purchased by the customer must also
be updated at this time. If the item purchased has a non-zero amount for bonus points,
these bonus points are also added to the points balance of the customer.
7. Make a redemption
Customers can redeem a gift when their points balance is equal to or greater than the
points value of the gift, and if the gift is available. If redeeming is successful, the points
value of the gift is subtracted from the points balance of the customer. The total number of
redemptions made by the customer must also be updated at this time.
8. Report on which customers are VIP customers
If a customer has purchased 5 or more items they are considered a VIP customer. A
method must be provided in the Customer class that determines this.
NOTE: It is expected that if an error occurs e.g. if a customer does not have enough money to
purchase an item, then the system will display an appropriate error message. This applies for all
common errors.
Program Flow:
Add a main method to the project (in Customer or another class) so that:
a) two Customer objects are created
b) four Item objects are created
c) two Gift objects are created
The main method will then be used to simulate the usage of the rewards system. All functionality
listed above must be demonstrated – an example simulation could be:
- Display the name of each Customer in the system (there are two)
- Display the name of each Item available for purchase
- Demonstrate update methods for Customer
- Demonstrate update methods for Item
- Demonstrate update methods for Gift
- Display the price and points value for an item
- Allow a customer to purchase an item (zero bonus points for the item)
- Allow a customer to purchase an item (non-zero bonus points for the item)
- Allow a customer to redeem a gift
- Display whether the two customers are VIP customers or not