10.21 LAB*: Program: Online shopping cart (Part 2) This program extends the earlier "Online shopping cart" program. (Con

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

10.21 LAB*: Program: Online shopping cart (Part 2) This program extends the earlier "Online shopping cart" program. (Con

Post by answerhappygod »

10.21 LAB*: Program: Online shopping cart (Part 2)
This program extends the earlier "Online shopping cart" program.
(Consider first saving your earlier program).
(1) Extend the ItemToPurchase class to contain a new attribute.
(2 pts)
Implement the following method for the ItemToPurchase class.
Ex. of print_item_description() output:
(2) Build the ShoppingCart class with the following data
attributes and related methods. Note: Some can be method stubs
(empty methods) initially, to be completed in later steps.
Ex. of print_total() output:
Ex. of print_descriptions() output:
(3) In the main section of the code, prompt the user for a
customer's name and today's date. Output the name and date. Create
an object of type ShoppingCart. (1 pt)

Ex:
(4) Implement the print_menu() function to print the following menu
of options to manipulate the shopping cart. (1 pt)

Ex:
(5) Implement the execute_menu() function that takes 2 parameters:
a character representing the user's choice and a shopping cart.
execute_menu() performs the menu options described below, according
to the user's choice. (1 pt)
(6) In the main section of the code, call print_menu() and prompt
for the user's choice of menu options. Each option is represented
by a single character.
If an invalid character is entered, continue to prompt for a
valid choice. When a valid option is entered, execute the option by
calling execute_menu(). Then, print the menu and prompt for a new
option. Continue until the user enters 'q'. Hint:
Implement Quit before implementing other options. (1
pt)

Ex:
(7) Implement Output shopping cart menu option in execute_menu().
(3 pts)

Ex:
(8) Implement Output item's description menu option in
execute_menu(). (2 pts)

Ex:
(9) Implement Add item to cart menu option in execute_menu(). (3
pts)

Ex:
(10) Implement remove item menu option in execute_menu(). (4
pts)

Ex:
(11) Implement Change item quantity menu option in
execute_menu(). Hint: Make new ItemToPurchase object
before using ModifyItem() method. (5 pts)

Ex:
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply