Question: ShoppingCart Class Create variables for ShoppingCart Class Private: _ Customer Private: _ product 1 Private: _ product 2 Private: _ product 3 Create Constructor that

ShoppingCart Class
Create variables for ShoppingCart Class
Private: _Customer
Private: _product1
Private: _product2
Private: _product3
Create Constructor that takes in a Customer as an argument
ShoppingCart(Customer cust)
Make sure that the GetCustomerId() returns the same Id as the customer that was put in the argument in the constructor.
Create Methods
GetCustomerId() : int
Returns the customer's id
GetProductById(int id) : ShoppingCartItem
Returns the product with matching id
AddProduct(Product prod) : ShoppingCartItem
Runs other add product method with quantity of 1
AddProduct(Product prod, int quantity) : ShoppingCartItem
Checks for valid quantity
Checks for product and adds quantity if found
Adds product if new
Returns the product changed or null
RemoveProduct(Product prod, int quantity) : ShoppingCartItem
Checks for valid quantity
Checks for product and removes quantity if found
Returns the product changed or null
GetTotal() : decimal
returns total of all products
GetProduct(int prodNum) : ShoppingCartItem
returns the product in the position of prodNumor null
 ShoppingCart Class Create variables for ShoppingCart Class Private: _Customer Private: _product1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!