Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assume you have 2 tables ShoppingCart and ShoppingCartLine. ShoppingCart contain

ID: 3718246 • Letter: A

Question

Assume you have 2 tables ShoppingCart and ShoppingCartLine. ShoppingCart contains information such as order originator, order shipment, and order total that contains the total of all the items in the shopping cart. ShoppingCartLine contains one row for each line on the shipping cart including total for that line item. (a) Discuss why transaction may be important in this scenario. (b) Write pseudo code showing the sequence of new line added to a shopping cart. Be sure to show to show transaction, shopping cart and shopping cart line.

Explanation / Answer

Transaction will contain information such as item purchased, quantity of item, cost of item, who purchased it and where they purchased it. This will help us to know total quantity of items being purchased, total cost of items and demographics related information related to each item. This kind of information isn't captured in ShoppingCart table because the information is aggregated there.

b) ShoppingCart: Check order id and item id of the transaction
2) If order id is unique then insert new record
3) If item id is repeated for same order id then increase the cost of item and quantity of item

ShoppingCartLine: Check if order id is repated in trasaction
2) If yes then add the quantity of items and cost of items of that trasaction to total cost and quantiry purchased for that order id
3) If no then add a new record

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote