This Java project implements a shopping management system with a focus on inheritance and encapsulation principles. The system includes a console-based menu for the manager and a graphical user interface (GUI) for the client.
- Overview
- Classes and Implementation
- Console Menu Implementation (Phase 2)
- Graphical User Interface (GUI) Implementation (Phase 3)
- File Handling
- How to Run
The shopping management system allows a manager to add, delete, and view products (Electronics and Clothing) through a console menu. Clients interact with the system through a GUI, where they can view products, add them to a shopping cart, and see the final price with applicable discounts.
The Product class is an abstract superclass that includes:
productID(String): A mix of characters and numbersproductName(String)availableItems(int)price(double)
Includes appropriate getter and setter methods and at least one constructor.
The Electronics subclass extends Product and includes:
brand(String)warrantyPeriod(int)
Includes appropriate getter and setter methods and at least one constructor.
The Clothing subclass extends Product and includes:
size(String)color(String)
Includes appropriate getter and setter methods and at least one constructor.
The User class represents a user account and includes:
username(String)password(String)
Includes appropriate getter and setter methods and at least one constructor.
The ShoppingCart class represents a user's cart and includes:
- A list of
Productobjects
Methods:
addProduct(Product product)removeProduct(Product product)calculateTotalCost()
The WestminsterShoppingManager class implements the ShoppingManager interface and maintains the list of products. It provides methods for:
- Adding a new product
- Deleting a product by product ID
- Printing the list of products
- Saving and loading products from a file
The console menu allows the manager to:
- Add a new product (Electronics or Clothing)
- Delete a product by ID
- Print the list of products (ordered alphabetically by product ID)
- Save the list of products to a file
The GUI allows the client to:
- Select the type of product to view (All, Electronics, Clothing) from a drop-down menu
- View a table of products with all relevant information
- Items with less than 3 available appear in red
- Product details appear in a panel below the table when selected
- Add products to a shopping cart
- View the shopping cart with a list of products and the final price
The system saves the list of products to a file and loads it upon starting the application, allowing it to persist data across sessions.
- Compile all the Java files.
- Run the
Mainclass to start the console menu. - Select the option to open the GUI from the console menu.