Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in Python, Class TEMPLATE FOR RetailItem class : #Create the Employee class class Employee: #The __init__ method initializes the attributes def __init__(self, name, id_number, department,

in Python, Class TEMPLATE FOR RetailItem class :

#Create the Employee class

class Employee: #The __init__ method initializes the attributes def __init__(self, name, id_number, department, title): self.__name = name self.__id_number = id_number self.__department = department self.__title = title

#The set_name method sets the employee name def set_name(self,name): self.__name = name

#The set_id_number method sets the employee ID def set_id_number(self, id_number): self.__id_number = id_number

#The set_department method sets the employee department def set_department(self, department): self.__department = department

#The set_title method sets the employee job title def set_title(self, title): self.__title = title

#create get methods #The get_name method returns the employee name def get_name(self): return self.__name #return id_number type method def get_id_number(self): return self.__id_number #return department method def get_department(self): return self.__department

#return title method def get_title(self): return self.__title

# The __str__ method returns the object's state # as a string. def __str__(self): return "Name: " + self.__name + \ " ID: " + self.__id_number + \ " Dept.: " + self.__department + \ " Title: " + self.__title

image text in transcribed

5. Retailltem Class Write a class named Retaillitem 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: Description Units in Inventory Price Item #1 Jacket 12 59.95 Item #2 Designer Jeans 40 34.95 Item #3 Shirt 20 24.95 8. Cash Register This exercise assumes you have created the Retaillter class for Programming Exercise 5. Create a CashRegister class that can be used with the Retailltem class. The Cash Register class should be able to internally keep a list of Retailltem objects. The class should have the following methods: A method named purchase_item that accepts a Retailltem object as an argument. Each time the purchase_item method is called, the Retailltem object that is passed as an argument should be added to the list. A method named get_total that returns the total price of all the Retailiter objects stored in the CashRegister object's internal list. A method named show_items that displays data about the Retailltem objects stored in the CashRegister object's internal list. A method named clear that should clear the CashRegister object's internal list

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

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

Students also viewed these Databases questions

Question

Explain the importance of Human Resource Management

Answered: 1 week ago

Question

How does XBRL facilitate Data Analytics by analysts?

Answered: 1 week ago

Question

What would a horizontal trend tell you about a firms performance?

Answered: 1 week ago