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: product
Private: product
Private: product
Create Constructor that takes in a Customer as an argument
ShoppingCartCustomer 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
GetProductByIdint id : ShoppingCartItem
Returns the product with matching id
AddProductProduct prod : ShoppingCartItem
Runs other add product method with quantity of
AddProductProduct 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
RemoveProductProduct 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
GetProductint prodNum : ShoppingCartItem
returns the product in the position of prodNumor null
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
