Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Products: 4 . Class Product This class is to keep track of information on different products that the pharmacy offers. This class supports the following
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
Orders
Class Order
This class is to store a customer's purchase information. This class supports the following
information of an order:
customer: the one who makes the purchase can be a Basic or VIP customer You need to thinkanalyse carefully if this should be an ID name, or something else.
product: the product of the purchase. You need to thinkanalyse carefully if this should be an ID name, or something else.
quantity: the quantity of the product ordered by the customer
A method computecost that returns the original total cost the cost before the
discount the discount, the final total cost the cost after the discount and the reward. For example, if the original total cost of an order of the customer Tom VIP customer with reward rate of and discount rate of is then this method will return
Extra attributes and methods if you want to define.
Records
Class Records
This class is the central data repository of your program. It supports the following information:
a list of existing customers you need to think what you should store in this list
customer ID customer name, or something else?
a list of existing products you need to think about what you should store in this list
product ID product name, or something else?
This class has a method named readcustomers. This method takes in a file name and then read and add the customers in this file to the customer list of the class. In the sequel, we call this the customer file. See an example of the customer file below.
In this file, the customers are always in this format: customerID customername,
reward rate, discountrate if that is a VIP customer and reward. For example, in the
st line, the customerID is B the name is James, the reward rate is and the
reward point is In the rd line, the customerID is V the name is Tom, the reward
rate is the discount rate is and the reward point is A Basic customer has an ID starting with the letter B whilst a VIP customer has an ID starting with the letter V The numbers in the ID after these characters B V are all unique ie are unique; for example, if there is a customer with the ID of B there won't be a customer with the ID of V In this part, you can assume there will be no error in this customer file eg the data format is always correct, and the reward and discount values are always valid
This class has another method named readproducts. This method takes in a file name and can read and add the products stored in that file to the product list of the class. In the sequel, we call this the product file. See an example of the product file below. In this file, the products are always in this format: productID productname,
unitprice. The product ID always starts with the letter P The product IDs and names are all unique. You can assume there will be no error in this file eg the data format is always correct, and the values are always valid
This class also has two methods findcustomer and findproduct. These methods take in a search value can be either a name or an ID of a customer or product search through the list of customersproducts and then return the corresponding
customerproduct if found or return None if not found.
This class also has two methods listcustomers and listproducts. These methods can display the information of existing customers and products on screen. The method listcustomers will display the customer ID name, the reward rate, the discount rate 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.
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