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.

For step 1 you will be creating the basic objects used to construct and manipulate the shopping cart. These objects are described by the UML diagram in figure 1.

These rules define the conditions that the application must meet ...

  • 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.

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

When your program begins, you will display a menu of actions the shopper can perform:

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

Using the Java ArrayList class, you will write a program to support these functions. Each item added to the cart will be represented with the Item class (see attached .java files).

Your program will allow the user to perform all the functions listed. The program should continue as long as the user wants to keep going.

You should make use of everything we have studied to date, e.g., use the NumberFormat class to format currency amounts. See image.

Files provide for assignment:

  • Inventory.txt – Text file for the shop database, used by Shop.java. If you use Eclipse, this needs to be added to the project. You should be able to drag and drop the Inventory.txt file onto the project you create for this exercise. It should appear at the same level in the project as src folder at the JRE System Library. If you run from the command prompt, it needs to be in the same folder as the .class files.
  • Item.java – Incomplete class for the shopping cart item, syntax errors in file
  • Product.java – Complete implementation of the Product class
  • Shop.java – Complete implementation of the Shop class
  • Shopping.java – Incomplete driver for the shopping cart

You will need to complete Item.java and Shopping.java so the cart functions as described above. Please submit these two files for the project in WebStudy. You may submit all the files from the project if you wish.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only 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 fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.