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

can someone please help me? it has to be in python. Design a class called ItemTo

ID: 3906371 • Letter: C

Question

can someone please help me? it has to 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

Explanation / Answer

SOlution:

"C:UsersSubrat KumarAppDataLocalProgramsPythonPython36-32pythonw.exe" "C:/Users/Subrat Kumar/.PyCharmCE2018.1/config/scratches/histogram.py"
How many items 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 Amount: $28.75

Process finished with exit code 0

Note: If you have any doubt do let me know in the comment section, before giving me the negative feedback. If you really liked the solution then please give a big thumbs up. :)

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