Question
1. Designandclassimplementation(Phase1) The design of your system should be consistent with the Object-oriented principles and easy to understand by an independent programmer. You are required
1. Designandclassimplementation(Phase1)
The design of your system should be consistent with the Object-oriented principles and easy to understand by an independent programmer.
You are required to design your program using UML diagrams. In particular, you have to draw:
A UML use case diagram for the system (6 marks).
A UML class diagram (6 marks)
Read carefully the following requirements. It is important that you follow the specifications, and your design and implementation must comply with these. According to the Inheritance and encapsulation principles, you have to design and implement a super-class Product and the subclasses Electronics and Clothing. Also, you will have to add at least one constructor for each class.
The class Product should be abstract and include appropriate get/set methods and hold information about the product ID (mix of characters and numbers), product name, number of available items and the price (4 marks). (You can add any other information that you consider appropriate).
In particular:
The Electronics subclass should hold specific information and methods. You should add the brand and the warranty
period as instance variables, constructors, and the relative get/set methods (3 marks).
The Clothing subclass should hold specific information and methods. You should add the size and colour as instance
variables (attribute), constructors and the relative get/set methods (3 marks).
You should implement a class User to represent the user account. The class should hold information about the
username and password, constructors, and the relative get/set methods (3 marks).
You should implement a class ShoppingCart to represent the users cart. The class should contain a list of products as instance variable, there should be methods to add, remove and calculate the total cost (3 marks).
Design and implement a class called WestminsterShoppingManager, which implements the interface ShoppingManager (2 marks). WestminsterShoppingManager maintains the list of the products in the system and provides all the methods for the system manager defined in the console menu.
2. ConsoleMenuImplementation(Phase2) The class WestminsterShoppingManager should display a menu in the console (not in the GUI) containing the
following management actions from which the manager can select one. You should have a menu with a list of options
Add a new product to the system. It should be possible to add either electronics or clothing, with all the relevant information (all the attributes defined in the relative class). You should consider that the system can have a maximum of 50 products (5 marks).
Delete a product from the system, inserting the product ID. Display a message with the information of the product (if it is electronics or clothing) that has been deleted and the total number of products left in the system (5 marks).
Print the list of the products in the system. For each product, print on the screen all the information (attributes defined in the corresponding class) and say if it is electronics or clothing. The list should be ordered alphabetically according to the product ID (6 marks).
Save in a file the list of products that have been added to the system, with all the relative attributes. The next time the application starts, it should be able to read back all the information saved in the file and continue to use the system (6 marks).
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