I have created a class ShoppingCart that constructs a new arry from a class called Item. The Item array consists of 10 elements. Each Item element holds an Item object that contains the instance variables
When the array is first created the first index of the array becomes non-null and the remaining nine indices are still null objects. As a new Item object is added to the Item array I need to compare the new objects barcode data with the existing array elements' barcode data. If the data are the same then I need to only update the quantity of the item and not store this object information again in a separate array. Only the quantity data needs to be updated.
Here is the code that I have so far for this particular algorithm. Although it doesn't create compile-time or run-time errors, it does not function as it should