Ch 9 Program Online Shopping Cart Continued Python 3

11.12 LAB*: Program: Online shopping cart (continued) Python 3 ,ZyBooks

Can any one help me with this code I've been stuck for hours andnot getting any were close..

Students: This content is controlled by your instructor, and is not zyBooks content. Direct questions or concerns about this

• remove_item o Removes item from cart_items list. Has a string (an items name) parameter. Does not return anything. If item

Ex. of print_total output: John Does Shopping Cart - February 1, 2016 Number of Items: 8 Nike Romaleos 2 @ $189 = $378 Choco

(6) Implement Output items description menu option. (2 pts) Ex OUTPUT ITEMS DESCRIPTIONS John Does Shopping Cart - Februar

Enter name of item to remove: Chocolate Chips (9) Implement Change item quantity menu option. Hint: Make new Item To Purchase

Students: This content is controlled by your instructor, and is not zyBooks content. Direct questions or concerns about this content to your instructor. If you have any technical issues with the zyLab submission system, use the Trouble with lab button at the bottom of the lab. Students: Section 11.12 is a part of 1 assignment: Wk 5: Ch. 11 zyLabs (due Mon] Requirements: zyLab Entire class due: 02/06/2020, 5:59 PM 11.12 LAB*: Program: Online shopping cart (continued) This program extends the earlier "Online shopping cart" program. (Consider first saving your earlier program). (1) Extend the Item ToPurchase class to contain a new attribute. (2 pts) • item_description (string) - Set to "none" in default constructor Implement the following method for the Item To Purchase class. • print_item_description - Prints item_description attribute for an ItemToPurchase object. Has an Item ToPurchase parameter. Ex. of print_item_description() output: Bottled Water: Deer Park, 12 oz. (2) Build the Shopping Cart class with the following data attributes and related methods. Note: Some can be method stubs (empty methods) initially, to be completed in later steps. • Parameterized constructor which takes the customer name and date as parameters (2 pts) • remove_item o Removes item from cart_items list. Has a string (an item's name) parameter. Does not return anything. If item name cannot be found output this message: Item not found in cart. Nothing removed. • modify_item o Modifies an item's description, price, and/or quantity. Has parameter ItemToPurchase. Does not return anything. o If item can be found (by name) in cart, check if parameter has default values for description, price, and quantity. If not, modify item in cart. o If item cannot be found (by name) in cart, output this message: Item not found in cart. Nothing modified. • get_num_items_in_cart0 (2 pts) o Returns quantity of all items in cart. Has no parameters. • get_cost_of_carto (2 pts) o Determines and returns the total cost of items in cart. Has no parameters. • print_totalo o Outputs total of objects in cart. o If cart is empty, output this message: SHOPPING CART IS EMPTY • print_descriptions() o Outputs each item's description. Ex. of print_total output: John Doe's Shopping Cart - February 1, 2016 Number of Items: 8 Nike Romaleos 2 @ $189 = $378 Chocolate Chips 5 @ $3 = $15 Powerbeats 2 Headphones 1 @ $128 = $128 Total: $521 Ex. of print_descriptions() output: John Doe's Shopping Cart - February 1, 2016 Item Descriptions Nike Romaleos: Volt color, Weightlifting shoes Chocolate Chips: Semi-sweet Powerbeats 2 Headphones: Bluetooth headphones Ex. of print_total output: John Doe's Shopping Cart - February 1, 2016 Number of Items: 8 Nike Romaleos 2 @ $189 = $378 Chocolate Chips 5 @ $3 = $15 Powerbeats 2 Headphones 1 @ $128 = $128 Total: $521 Ex. of print_descriptions() output: John Doe's Shopping Cart - February 1, 2016 Item Descriptions Nike Romaleos: Volt color, Weightlifting shoes Chocolate Chips: Semi-sweet Powerbeats 2 Headphones: Bluetooth headphones (3) In main section of your code, prompt the user for a customer's name and today's date. Output the name and date. Create an object of type Shopping Cart (1 pt) Ex. Enter customer's name: John Doe Enter today's date: February 1, 2016 Customer name: John Doe Today's date: February 1, 2016 (4) Implement the print_menu() function. print_menu() has a Shopping Cart parameter, and outputs a menu of options to manipulate the shopping cart. Each option is represented by a single character. Build and output the menu within the function. If the an invalid character is entered, continue to prompt for a valid choice. Hint: Implement Quit before implementing other options. Call (6) Implement Output item's description menu option. (2 pts) Ex OUTPUT ITEMS' DESCRIPTIONS John Doe's Shopping Cart - February 1, 2016 Item Descriptions Nike Romaleos: Volt color, Weightlifting shoes Chocolate Chips: Semi-sweet Powerbeats 2 Headphones: Bluetooth headphones (7) Implement Add item to cart menu option. (3 pts) ADD ITEM TO CART Enter the item name: Nike Romaleos Enter the item description: volt color, Weightlifting shoes Enter the item price: 189 Enter the item quantity: (8) Implement remove item menu option. (4 pts) REMOVE ITEM FROM CART Enter name of item to remove: Chocolate Chips (9) Implement Change item quantity menu option. Hint: Make new Item ToPurchase object before using Modifyltem() method. (5 pts) Enter name of item to remove: Chocolate Chips (9) Implement Change item quantity menu option. Hint: Make new Item To Purchase object before using Modifyltem() method. (5 pts) Ex: CHANGE ITEM QUANTITY Enter the item name: Nike Romaleos Enter the new quantity: LAPIVITY LAB ACTIVITY 11.12.1: LABUP 11.12.1: LAB*: Program: Online shopping cart (continued) 8/29 main.py Load default template... Hemtin 1 class ItemToPurchase: def __init__(self, item_name="none", item_price=0, item_quantity=0, item_description="none"): self.item_name = item_name self.item_price = item_price self.item_quantity = item_quantity self.item_description = item_description def print_item_cost(self): self.print_cost = (self.item_quantity * self.item_price) print(('{}{} @ ${} = ${}').format(self.item_name, self.item_quantity, self.item_price, self.print_cost)) def print_item_description(self): print(self.item_name, end=": ") print(self.item_description) SMS class ShoppingCart: def __init__(self, customer_name = 'none', current_date = 'January 1, 2016', cart_items = []): self.customer_name = customer_name self.current_date = current_date self.cart_items = cart_items def add_item(self, string): print("nADD ITEM TO CART', end='n') Develop mode Submit mode When done developing your program, press the Submit for grading button below. This will submit your program for auto-grading. Submit for grading Show transcribed image text Students: This content is controlled by your instructor, and is not zyBooks content. Direct questions or concerns about this content to your instructor. If you have any technical issues with the zyLab submission system, use the Trouble with lab button at the bottom of the lab. Students: Section 11.12 is a part of 1 assignment: Wk 5: Ch. 11 zyLabs (due Mon] Requirements: zyLab Entire class due: 02/06/2020, 5:59 PM 11.12 LAB*: Program: Online shopping cart (continued) This program extends the earlier "Online shopping cart" program. (Consider first saving your earlier program). (1) Extend the Item ToPurchase class to contain a new attribute. (2 pts) • item_description (string) - Set to "none" in default constructor Implement the following method for the Item To Purchase class. • print_item_description - Prints item_description attribute for an ItemToPurchase object. Has an Item ToPurchase parameter. Ex. of print_item_description() output: Bottled Water: Deer Park, 12 oz. (2) Build the Shopping Cart class with the following data attributes and related methods. Note: Some can be method stubs (empty methods) initially, to be completed in later steps. • Parameterized constructor which takes the customer name and date as parameters (2 pts)
• remove_item o Removes item from cart_items list. Has a string (an item's name) parameter. Does not return anything. If item name cannot be found output this message: Item not found in cart. Nothing removed. • modify_item o Modifies an item's description, price, and/or quantity. Has parameter ItemToPurchase. Does not return anything. o If item can be found (by name) in cart, check if parameter has default values for description, price, and quantity. If not, modify item in cart. o If item cannot be found (by name) in cart, output this message: Item not found in cart. Nothing modified. • get_num_items_in_cart0 (2 pts) o Returns quantity of all items in cart. Has no parameters. • get_cost_of_carto (2 pts) o Determines and returns the total cost of items in cart. Has no parameters. • print_totalo o Outputs total of objects in cart. o If cart is empty, output this message: SHOPPING CART IS EMPTY • print_descriptions() o Outputs each item's description. Ex. of print_total output: John Doe's Shopping Cart - February 1, 2016 Number of Items: 8 Nike Romaleos 2 @ $189 = $378 Chocolate Chips 5 @ $3 = $15 Powerbeats 2 Headphones 1 @ $128 = $128 Total: $521 Ex. of print_descriptions() output: John Doe's Shopping Cart - February 1, 2016 Item Descriptions Nike Romaleos: Volt color, Weightlifting shoes Chocolate Chips: Semi-sweet Powerbeats 2 Headphones: Bluetooth headphones
Ex. of print_total output: John Doe's Shopping Cart - February 1, 2016 Number of Items: 8 Nike Romaleos 2 @ $189 = $378 Chocolate Chips 5 @ $3 = $15 Powerbeats 2 Headphones 1 @ $128 = $128 Total: $521 Ex. of print_descriptions() output: John Doe's Shopping Cart - February 1, 2016 Item Descriptions Nike Romaleos: Volt color, Weightlifting shoes Chocolate Chips: Semi-sweet Powerbeats 2 Headphones: Bluetooth headphones (3) In main section of your code, prompt the user for a customer's name and today's date. Output the name and date. Create an object of type Shopping Cart (1 pt) Ex. Enter customer's name: John Doe Enter today's date: February 1, 2016 Customer name: John Doe Today's date: February 1, 2016 (4) Implement the print_menu() function. print_menu() has a Shopping Cart parameter, and outputs a menu of options to manipulate the shopping cart. Each option is represented by a single character. Build and output the menu within the function. If the an invalid character is entered, continue to prompt for a valid choice. Hint: Implement Quit before implementing other options. Call
(6) Implement Output item's description menu option. (2 pts) Ex OUTPUT ITEMS' DESCRIPTIONS John Doe's Shopping Cart - February 1, 2016 Item Descriptions Nike Romaleos: Volt color, Weightlifting shoes Chocolate Chips: Semi-sweet Powerbeats 2 Headphones: Bluetooth headphones (7) Implement Add item to cart menu option. (3 pts) ADD ITEM TO CART Enter the item name: Nike Romaleos Enter the item description: volt color, Weightlifting shoes Enter the item price: 189 Enter the item quantity: (8) Implement remove item menu option. (4 pts) REMOVE ITEM FROM CART Enter name of item to remove: Chocolate Chips (9) Implement Change item quantity menu option. Hint: Make new Item ToPurchase object before using Modifyltem() method. (5 pts)
Enter name of item to remove: Chocolate Chips (9) Implement Change item quantity menu option. Hint: Make new Item To Purchase object before using Modifyltem() method. (5 pts) Ex: CHANGE ITEM QUANTITY Enter the item name: Nike Romaleos Enter the new quantity: LAPIVITY LAB ACTIVITY 11.12.1: LABUP 11.12.1: LAB*: Program: Online shopping cart (continued) 8/29 main.py Load default template... Hemtin 1 class ItemToPurchase: def __init__(self, item_name="none", item_price=0, item_quantity=0, item_description="none"): self.item_name = item_name self.item_price = item_price self.item_quantity = item_quantity self.item_description = item_description def print_item_cost(self): self.print_cost = (self.item_quantity * self.item_price) print(('{}{} @ ${} = ${}').format(self.item_name, self.item_quantity, self.item_price, self.print_cost)) def print_item_description(self): print(self.item_name, end=": ") print(self.item_description) SMS class ShoppingCart: def __init__(self, customer_name = 'none', current_date = 'January 1, 2016', cart_items = []): self.customer_name = customer_name self.current_date = current_date self.cart_items = cart_items def add_item(self, string): print("nADD ITEM TO CART', end='n') Develop mode Submit mode When done developing your program, press the Submit for grading button below. This will submit your program for auto-grading. Submit for grading

flaniganyouret.blogspot.com

Source: https://www.answersproject.com/ExpertAnswers/1112-lab-program-online-shopping-cart-continued-python-3-zybooks-one-help-code-ve-stuck-ho

0 Response to "Ch 9 Program Online Shopping Cart Continued Python 3"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel