CSCI 111, Inlab 3

Inlab 3: A Cart GroceryItems

Due: Friday 8 July at 6:00 pm



This is an individual assignment, though collaboration (not solution sharing) is allowed.

Problem Statement

This project has two phases. The first phase is to create a Cart class that will represent a shopping cart. You will be able to add GroceryItem objects to instances of your Cart class and calculate the cost (plus 7% tax) of the items in the cart. To simplify and standardize things, I will provide a GroceryItem class that is very similar to the one you developed in Outlab1.

The second phase will involve keeping inventory of GroceryItems up to date based on how many were purchased. You may make the following assumptions about the system to make things easier:

  1. GroceryItems will not be removed from the Cart. Once some number of a GroceryItem is placed in a Cart, it will be purchased.
  2. You do not need to format your numerical output to have the correct number of decimal places for currency (see output below).
  3. Each cart will have exactly two types of items in it before the receipt is printed.
  4. Users will not try to add more units of a GroceryItem into a Cart than there are in stock. (Only applicable for phase 2)


Phase 1 (Grocery Cart):

Phase 2 (Inventory Tracking):


By Friday afternoon at 6:00 pm, submit the files,, and into the appropriate D2L dropbox folder. DO NOT SUBMIT .class files.

Grading - 10 points

Phase 1

Phase 2