Answered step by step
Verified Expert Solution
Question
1 Approved Answer
At this level, your program will have some basic classes with specifications as below. You may need o define methods wherever appropriate to support these
At this level, your program will have some basic classes with specifications as below. You may need
o define methods wherever appropriate to support these classes. At the end of the PASS level, your
orogram should be able to run with a menu described in the class Operations.
Customers:
Class Customer
Each customer has a unique ID unique name a name will only contain alphabet characters
Each customer also has some reward points. You are required to write the class named
Customer to support the following:
i Attributes ID name, and reward
ii Constructor takes the values of ID name, and reward as arguments
iii. Appropriate getter methods for the attributes of this class
iv A method getreward which should be an empty super method
v A method getdiscount which should be an empty super method
vi A method updatereward which should be an empty super method
vii. A method displayinfo which should be an empty super method
Class BasicCustomer
All Basic customers have a flat reward rate when making a purchase ie all Basic customers
have the same reward rate By default, the flat reward rate is The class BasicCustomer
should have the following components:
i An attribute for the reward rate
ii Constructor takes the appropriate parametersarguments
iii. Appropriate getter methods for the attributes of this class
iv A method getreward which takes the total cost and returns the reward. Note, the
reward is always rounded. For example, when the total cost is and the reward rate
is then the method will returns the reward which is round
v A method updatereward which takes a value and increase the attribute reward with
that value.
vi A method displayinfo that prints the values of the BasicCustomer attributes.
vii. A method setrewardrate to adjust the reward rate. This method affects all Basic
customers.
Class VIPCustomer
A VIP customer not just receives the reward but also gets a discount for the purchase. The
reward rate is the same for all VIP customers and has the default value of On the other
hand, the discount rate is different among VIP customers. If not specified, the discount rate is
set as
Note that the reward is computed after the discount. For example, with a reward rate of
and discount rate of if a VIP customer makes a purchase with the original total cost of $
then discount will be $ the total cost after the discount is $ and thus, the
reward is round
The class VIPCustomer should have the following components:
i Appropriate attributes to support the reward rate and discount rate ii Constructor takes the appropriate parametersarguments
iii. Appropriate getter methods for the attributes of this class
iv A method getdiscount which takes the total cost and returns the discount offered
v A method getreward which takes the total cost and returns the reward
vi A method updatereward which takes a value and increase the attribute reward with
that value.
vii. A method displayinfo that prints the values of the VIPCustomer attributes
viii. A method setrewardrate to adjust the reward rate. This method affects all VIP
customers
ix A method setdiscountrate to adjust the discount rate of each individual VIP
customer
Products:
Class Product
This class is to keep track of information on different products that the pharmacy offers. This
class supports the following information:
ID: a unique identifier of the product
name: the name of the product you can assume the product names are unique and they
do not include any digit
price: the unit price of the product
A method displayinfo that prints the values of the Product attributes
Extra attributes and methods if you want to define for VIP customers and the reward. The method listproducts will display the product
ID product name, and the unit price. Note the two methods can be used to validate the
reading from the two txt files associated with the customers and products.
NOTE you are allowed to add extra attributes and methods in this class if these attributes and
methods make your program more efficient.
Operations
Class Operations
This can be considered the main class of your program. It supports a menu with the following options:
i Make a purchase: this option allows users to make a purchase for a customer. Detailed
requirements for this option are below Requirements vix
ii Display existing customers: this option can display all the information of all existing customers:
ID name, reward rate, discount rate only for VIP customers and reward.
iii. Display existing products: this option can
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started