Question: Help needed in Python ! Question 1 Formulate classes and use obiects to store and compute tabular information A small groccry in your ncighbourhood nccds
Help needed in Python !


Question 1 Formulate classes and use obiects to store and compute tabular information A small groccry in your ncighbourhood nccds to track thc items that it carrics. An item is either perishable or non-perishable. Test data for three items is given in Table Q1.1 bclow: Expiry 10 Dec 2018 26 Nov 2018 Item Code Item Name Quantity on Hand Cost Price(S) On Offer P101 NP210 P105 Real Raisins Tan Baking Paper 10 25 14 Yes No Yes NA Soup Tofu 1.85 Table 01.1 The class Item is an abstract class. It has the following methods Getter and setter methods for both quantity on hand and cost price. Use the property decorator A method that changes the attribute for whether the item is on offer. If the item is not on offer, make the item to be on offer. If the item is on offer, make it to be not on offer A method for the selling price which is the sum of its cost price and a profit margin, dependent on the type of item. A method for the offer price which is the selling price minus a discount. The discount rate is dependent on the type of item Abstract methods for computing the profit margin and the discount rate when the itcm is on offer . A string method that returns all its attributes except the cost price as a string The string also includes thc selling pricc if the item is not on offer or the offer price if the item is on offer Two examples are shown here: Pe09 Tan Baking Paper Available25 $3.90 (No Offer) P09 Tan Baking Paper Available25 $3.51 **Offer** The class Perishable has an additional attribute: expiryDate. It has the following methods A method that returns the profit margin which is 25% of its cost price. A method that returns the discount rate when the perishable item is on offer. The discount is dependent on the number of days before expiry according to Table Q1.2: . Days away from expi At least 30 days At least 15 days but less than 30 days 20% of selling price Less than 15 days Discount 10% of selling price 30% of selling price Question 1 Formulate classes and use obiects to store and compute tabular information A small groccry in your ncighbourhood nccds to track thc items that it carrics. An item is either perishable or non-perishable. Test data for three items is given in Table Q1.1 bclow: Expiry 10 Dec 2018 26 Nov 2018 Item Code Item Name Quantity on Hand Cost Price(S) On Offer P101 NP210 P105 Real Raisins Tan Baking Paper 10 25 14 Yes No Yes NA Soup Tofu 1.85 Table 01.1 The class Item is an abstract class. It has the following methods Getter and setter methods for both quantity on hand and cost price. Use the property decorator A method that changes the attribute for whether the item is on offer. If the item is not on offer, make the item to be on offer. If the item is on offer, make it to be not on offer A method for the selling price which is the sum of its cost price and a profit margin, dependent on the type of item. A method for the offer price which is the selling price minus a discount. The discount rate is dependent on the type of item Abstract methods for computing the profit margin and the discount rate when the itcm is on offer . A string method that returns all its attributes except the cost price as a string The string also includes thc selling pricc if the item is not on offer or the offer price if the item is on offer Two examples are shown here: Pe09 Tan Baking Paper Available25 $3.90 (No Offer) P09 Tan Baking Paper Available25 $3.51 **Offer** The class Perishable has an additional attribute: expiryDate. It has the following methods A method that returns the profit margin which is 25% of its cost price. A method that returns the discount rate when the perishable item is on offer. The discount is dependent on the number of days before expiry according to Table Q1.2: . Days away from expi At least 30 days At least 15 days but less than 30 days 20% of selling price Less than 15 days Discount 10% of selling price 30% of selling price
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
