Project description: Write a Java program to simulate an online shopping cart.

A shopping cart is a collection of items selected by a customer for purchase. A user can add items to the cart, remove them, empty the cart, view the items in the cart, view the items in the shop, and end shopping and proceed to checkout.

In step 2 you will be adding customer and payment objects to your model and implementation. Customers often become associated with a shopping cart after the cart has been created and filled.

The new rules (in bold) for the application are as follows ...

  • A Shopping Cart can be associated with many Items to Purchase.
  • An Item to Purchase can be associated with one and only one Product.
  • A Product can be associated with many Items to Purchase.
  • An Inventory can be associated with many Products.
  • A Shopping Cart can be associated with at most one Customer.
  • A Customer must have a billing address and may have a different shipping address.
  • A Customer may be associated with many Payment options. Options include credit card, PayPal, and bank account.

You will implement the classes, variables, and methods to allow the shopping cart to function.

  • For customer address, you will need to decide how to handle this, either as attributes of customer or as a separate class. Consider the advantages/disadvantages.
  • For customer email, you may install the JavaMail API (https://java.net/projects/javamail/pages/Home) to parse email addresses. See the Class javax.mail.internet.InternetAddress. This not required, but would prove helpful and demonstrate how to install additional packages for use with your project.
  • For payment, investigate using interfaces or inheritance for implementing the different options.
  • Implement variables and methods in keeping with how a shopping cart generally behaves.

New menu options (in bold):

SHOPPING CART OPTIONS:
0 exit the program
1 add an item to your cart
2 remove an item from your cart
3 change the quantity of an item in your cart
4 view the items in your cart
5 end shopping and go to checkout
6 empty your cart
7 list the items in the inventory
8 create a customer for the shopping cart
9 add a payment option for this customer

Figure. See image.

Files provide for assignment:

  • All the files from step 1 are needed. No additional files are provided at this time. You will need to create all the class files from scratch as necessary.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.