This is a simple command-line shopping cart system implemented in Java that demonstartes the usage of Singletone class. A Singleton class [ShoppingCart] is a class that allows only one instance of itself to be created and provides a global point of access to that instance. This is achieved by making the constructor private, so that no other instances of the class can be created, and providing a static method[STATIC fACTORY METHOD] that returns the single instance of the class. It allows users to add products to the cart, remove products from the cart, and view the contents of the cart.
- Add Product: Users can add products to the cart by providing the name and price of the product.
- Remove Product: Users can remove products from the cart by providing the name of the product.
- View Cart: Users can view the contents of the cart, including the names and prices of the products.
You can choose to add products, remove products, view the cart, or exit the program.