7.25 Chapter 7F
Use the CartItem class from Chapter 7E
Create the class described by the UML and directions givenbelow.
Test each method as you you enter it by making a main andcalling the functions
ShoppingCart- cart[]:CartItem
– numDiffItems: int+ShoppingCart()
+putInCart(item: CartItem): void
+putInCart(item: string, price: double, qty: int): void
+getCartItem(index: int): CartItem
+getNumDiffItems(): int
+removeFromCart(index: int): void
+numTotalItemsInCart(): int
+costOfCart(): double
+ displayCart():void
- at top of .h file, declare a constant MAX CART ITEMS and set itequal to 100
- when declaring the cart instance variable, make the array thesize of the constant
- Constructor with no arguments
- Sets numDiffItems to zero
- putInCart
- checks to make sure there is room in the array and then putsthe object into the array
- for
OROR