Write Python Program Purchasepy Class Named Itemtopurchase Itemtopurchase Class Following Q37098923

Write a Python program (purchase.py) that has a class namedItemToPurchase.

ItemToPurchase class has the following attributes:

  • item_name (string)
  • item_price (float)
  • item_quantity (int)

Your class should have the following methods:

(1) __init__(self, name, price, quantity): This method calledwhen an object is created from the class and it allows the class toinitialize the attributes of a class.

(2) print_item_cost(self): This method will print the total costof an item. It has no return.

Example print of the methos:

Bottled Water 5 @ $1.25 = $6.25

In the main, you do the following:

a. Prompt the user for two items and create two objects of theItemToPurchase class.

Item 1Enter the item name:Chocolate ChipsEnter the item price:3.2Enter

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.