0% found this document useful (0 votes)
11 views

Assignment 01 Fall 2024

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Assignment 01 Fall 2024

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Assignment 01

Due: Section B (Self+Open), SE December 03;


Section A (Self+Open) December 04
A retail store wishes to update its computer system and needs to store the following details:
Customer: idNo, name, shipping address, email address; Product: product ID, product name,
product quantity, product price; Order: order ID, date of order, products in the order. Employee:
empID, name, address, contact number, email address, job title.
a) Use composition to reduce the programming effort and store the data appropriately.
b) Write code for the order class, initializing the variables through constructors. An order can
have multiple products. Initially, an order has no products, but should be able to add products
to the order. If a product already exists in the order, increment the quantity of the product.
The class also has a method for removing a product from the order and a method for
displaying the products. The order class should have method to calculate the total price for all
the products. The class should also keep track of the total number of orders generated. A
cashier’s name might appear on the order receipt of the customer.
c) Write code for all the classes. You can add more classes or variables if required. Products can
be edible and non-edible. Nonedible items are charged sales tax at the rate of 17%.
d) All the classes should have str methods to print their details.
e) Propose a solution that allows the product objects to be initialized with and without an initial
quantity.
f) Write a function that instantiates the objects for all the classes and adds products to the order.
g) Draw a UML class diagram that shows the classes and the relationships among the different
classes you have identified.

You might also like