Answered step by step
Verified Expert Solution
Link Copied!

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:
1. 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 0 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 get_discount(self, price) which returns (0, 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 display_info 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:
2. 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 (i.e., 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 5%.
ii. Constructor takes the appropriate parameters/arguments (be careful)
iii. Appropriate getter methods for the attributes of this class
iv. A method get_discount(self, 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 (0.05,950) when the discount rate is 5% and the order's price is 1000$.
v. A method display_info(self) that prints the values of the Member attributes.
vi. A method set_rate to adjust the flat rate of discount. This affects all members.
3. 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 ($1000 by default), and the second rate applies when the order's price exceeds this threshold. For example, with the threshold being 1000$, then, when a VIP member named Sarah places an order that costs 800$, the discount rate for this order is the 1st discount rate; when Sarah places an order that costs 1200$, the discount rate for this order is the 2nd discount rate.
NOTE for all VIP members, the 2nd discount rate is always 5% more than the 1st discount rate. The discount rates might be different among the VIP members. If not specified, the first and second discount rates are set as 10% and 15%, respectively. On the other hand, the threshold applies to all VIP members, i.e., 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 get_discount(self, price) that takes the price of the order and returns both the discount rate and the price after the discount.
v. A method display_info that prints the values of the VIPMember attributes.
vi. A method set_rate to adjust the discount rates of each individual VIP member.
vii. A method set_threshold to adjust the threshold limit. This affects all VIP members.
Products
4. 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 (e.g., P1, P2, P3)
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
5. 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 think/analyse if this should be an ID, name, or something else.
Product: the product of the order. Note you need to think/analyse 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions

Question

13. Why have private pension plans grown rapidly in recent years?

Answered: 1 week ago