Please answer part A and B
Objective: Class composition In an online shopping web application, the user views several items to buy. Each item can be added to the shopping cart. When the user check-out, all the items in the shopping cart are listed and the total price is computed. A.
Design and Implement a class which can hold up to 20 Items. Use a normal array as a container for the items. The ShoppingCart class must have the following attributes and methods: Class attributes: All items must be declared private a. itemList defined as 1 dimensional array composed of the previously user defined Item data type (class) and holds a maximum size of 20 items.(refer to lab 4) numltems an integer represents the total number of items currently in the shopping cart defaulted to zero. b. Class constructors Only a default constructor should be defined to create an empty shopping cart. When this constructor is called, it should initialize the array itemList and set the numltems to zero ShoppingCart Class methods: a. Class Methods a. addltem(ltem anltem): this method take anlTem as input and add it to the itemList array. Each time an item is added, the numitem must be incremented. This methods returns nothing (void). removeltem(String itemname): this method takes an item name and remove it from the shopping cart itemList. If the item was removed correctly, this methods return true Boolean value. If the item is not in the itemList, it should return false Boolean value. b. c. checkout0: this method will print out a list of all items in the shopping cart and count and print the total items price. Note: you have to apply good programming style and documentation in developing and maintaining your codes. B. Use the previously implemented Class to test by doing the following 1. 2. 3. 4. Define a ShoppingCart Add the items to the shopping cart Remove one item from the shopping cart Checkout and display the total of the items in the cart. Note: you have to apply good programming style and documentation in developing and maintaining your codes