Answered You can hire a professional tutor to get the answer.

QUESTION

OO Assignment - Part 1 Write a class named Retail Item that holds data about an item in a retail store. The class should store the following data in...

OO Assignment - Part 1

Write a class named Retail Item that holds data about an item in a retail store. The class should store the following data in attributes: item description, units in inventory, and price. Make sure you write appropriate accessor and mutator methods as well as the __str__ method needed to print out the information about the stores retail inventory. Once you have written the class, write a program that creates three Retail Item objects and stores the following data in them:

The output of your test program will look something like this:

Retail Item 1: 

Description: Jacket 

Units in inventory: 12 

Price: $59.95

Retail Item 2: 

Description: Designer Jeans 

Units in inventory: 40 

Price: $34.95

Retail Item 3: 

Description: Shirt 

Units in inventory: 20 

Price: $24.95

OO Assignment - Part 2

This assignment assumes that you have finished OO Assignment - Part 1.

Create a CashRegister class that can be used with the RetailItem class you previously created. The CashRegister class should be able to keep a list of RetailItem objects. The class should have the following methods:

  • A method named purchase_item that accepts a RetailItem object as an argument. Each time the purchase_item method is called, the RetailItem object that is passed as an argument should be added to the list. Make sure you print out a message to the user to let them know that an item was added to the list.
  • A method named get_total that returns the total price of all the RetailItem objects stored in the CashRegister object's list. This method will loop through the list to produce the total which is then returned.

Next, write a program that tests your CashRegister class. I would suggest that your program does the following:

1) Create all the items for sale.

2) Create a cash register object.

3) Create a function called get_user_choice that displays a menu that allows the user to choose what item they want to purchase. 

4) Allow the user to . To do this, you will need a loop that will continue to display the menu (by calling the get_user_choice function you created) until they are ready to check out. Make sure that you check your inventory levels. If the inventory quantity of the item the user selected is 0 (zero), then you should display a message to the user that 'The item is out of stock.'. 

5) When the user is ready to check out, the program should display the total price of the items selected for purchase. 

CashRegisterwineRetailItemCashRegisterRetailItem

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question