Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can someone please help me figure this out? I have tried my best to get it started but I can't seem to figure it out.

can someone please help me figure this out? I have tried my best to get it started but I can't seem to figure it out. it must be in PYTHON

Design a class called ItemToPurchase. This class has the following attributes: item_name, item_price, and item_quanity; and has methods for checking the current value of each attribute, a method set_quantity for updating item_quantity value, and a method get_item_cost to return the cost of this item (calculating the product of item_price and item_quantity)

Design a function called take_item for creating an object of ItemToPurchase and returning the created object. The main function defines a list of ItemToPurchase objects called shopping_cart and then calls the function take_item in a for loop to add multiple items to the shopping_cart list. The main function calls a function show_cart to display all the items in the shopping_cart list, and then calls a function update_cart to update the quantity for an item in the shopping_cart (the item is identified by its item_name attribute). The main function calls a function check_out to calculate and display to total charge for all the items in the shopping_cart. The following is a sample output from this program. How many item to take? 3 Add Item # 1 Item Name: Coffee Item Price: 2.5 Item Quantity: 4 Add Item # 2 Item Name: Chip Item Price: 1.25 Item Quantity: 6 Add Item # 3 Item Name: Milk Item Price: 3.75 Item Quantity: 2 Items in the Shopping Cart: 4 Coffee $ 2.5 each 6 Chip $ 1.25 each 2 Milk $ 3.75 each Item for Update: Milk New Quantity: 3 Items in the Shopping Cart: 4 Coffee $ 2.5 each 6 Chip $ 1.25 each 3 Milk $ 3.75 each Check Out Total Charge: $28.75

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions

Question

What is injurious falsehood?

Answered: 1 week ago