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 to define methods wherever appropriate to support these
At this level, your program will have some basic classes with specifications as below. You may need to define methods wherever appropriate to support these classes. At the end of the PASS level, your program should be able to run with a menu described in the Operations.
Customers:
Class Customer i Attributes ID and name
ii Attribute value to store the total money the customer spent to date. A new customer will have the value of value to be before placing any order.
iii. Constructor takes the values of ID name, value as arguments
iv Appropriate getter methods for the attributes of this class
v A method getdiscountself price which returns price where the first return value represents the discount rate associated with the customer and the second value represents the input price. This method serves as a super method and will have a more complex implementation in the subclasses.
vi A method displayinfo that prints the values of the Customer attributes and the discount rate associated with the customer.
All customers have a unique ID unique name a name will not include any digit You are required to write the class named Customer to support the following:
Class Member
A member is a customer with a membership. When placing an order, a member will be offered a discount. All members are offered a discount of a flat rate ie the discount rate is the same for all orders this is to distinguish from the discount of VIPMember below The class Member should have the following components:
i An attribute for discount rate, by default, it is
ii Constructor takes the appropriate parametersarguments be careful
iii. Appropriate getter methods for the attributes of this class
iv A method getdiscountself price that takes the price of the order and returns both the discount rate and the price after the discount. For example, this method returns when the discount rate is and the order's price is $
v A method displayinfoself that prints the values of the Member attributes.
vi A method setrate to adjust the flat rate of discount. This affects all members.
Class VIPMember
A VIP member is a customer with a VIP membership. All VIP members are offered a discount based on two rates: the first rate applies when the price of the order is smaller or equal to a threshold $ by default and the second rate applies when the order's price exceeds this threshold. For example, with the threshold being $ then, when a VIP member named Sarah places an order that costs $ the discount rate for this order is the st discount rate; when Sarah places an order that costs $ the discount rate for this order is the nd discount rate.
NOTE for all VIP members, the nd discount rate is always more than the st discount rate. The discount rates might be different among the VIP members. If not specified, the first and second discount rates are set as and respectively. On the other hand, the threshold applies to all VIP members, ie all VIP members have the same threshold.
The class VIPMember should support the following components
i Attributes to support the two discount rates and the threshold limit
ii Necessary constructors
iii. Appropriate getter methods for the attributes of this class
iv A method getdiscountself price that takes the price of the order and returns both the discount rate and the price after the discount.
v A method displayinfo that prints the values of the VIPMember attributes.
vi A method setrate to adjust the discount rates of each individual VIP member.
vii. A method setthreshold to adjust the threshold limit This affects all VIP members.
Products
Class Product
This class is to keep track of information on different products that the department store sells. This class supports the following information:
ID: A unique identifier of the product eg P P P
Name: The name of the products you can assume the product names are unique and they do not include any digit
Price: The price of the product
Stock: the quantity of the product available in stock
You need to define appropriate attributes and methods to support the class Product. Note the stock quantity obviously will be changed. The product's price may also be changed by users.
Orders
Class Order
This class is to handle customers' orders. This class supports the following information of an order:
Customer: the one who place the order can be a normal customer, a customer with a normal membership, or a customer with a VIP membership Note you need to thinkanalyse if this should be an ID name, or something else.
Product: the product of the order. Note you need to thinkanalyse if this should be an ID name, or something else.
Quantity: the quantity of the product ordered by customers.
You need to think if there are any extra attributes and methods you want to define in this class
Note that this class can update information
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