Answered step by step
Verified Expert Solution
Question
1 Approved Answer
- Write a class named Retailltem that holds data about an item in a retail store. The class should store the following data in attributes:
- Write a class named Retailltem 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. - Once you have written the class, write a program that creates three Retailltem objects and stores the following data in them: Ex 3: - Using Retailltem class from the previous exercise, create another class named CashRegister that can be used with the Retailltem class. - The CashRegister class should be able to internally keep a list of Retailltem objects. - The CashRegister class should have the following methods: - purchase_item: That accepts a Retailltem object as an argument. Each time the purchase_item is called, the Retailltem object passed as an argument should be added to the list. - get_total: Returns the total price of all the Retailltem objects stored in the CashRegister object's internal list. - show_items: That displays data about the Retailltem objects stored in the CashRegister object's internal list. - clear: That clear CashRegister object's internal list. - Demonstrate the CashRegister class in a program that allows the user to select several items for purchase. When the user is ready for checkout, the program should display a list of all the items he/she has selected for purchase and the total price
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started