in python
Write a class named RetaiI_Item that holds data about an item in
a retail store. The class should store the following data in
attributes:
• Item Number • Item Description • Units in Inventory • Price
Create another class named Cash_Register that can be used with the
Retail_Item class. The Cash_Register class should be able to
internally keep a list of Retail_Item objects. The class should
include the following methods:
• A method named purchase_item that accepts a Retail_Item object as
an argument. Each time the purchase_item method is called, the
Retail_Item 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 Retail_Items objects stored in the Cash_Register’s internal
list. • A method named show_items that displays data about the
Retail_Item objects stored in the Cash_Register object’s internal
list. • A method named clear_items that should clear the
Cash_Register object’s internal list.
Write a main function that uses the Cash_Register class to allow
the user to select several items for purchase. When the user is
ready to check out, the program should display a list of all the
items he or she has selected for purchase, as well as the total
price, taxes, and the final price.
You will not get credit if the program is not written or does not
work as expected.
Initial Inventory
Item Number Description Units in Inventory Price 1000 Pants 10
19.99 2000 Jeans 2 25.95 3000 Shirt 15 12.50 4000 Dress 3 79.00
5000 Socks 50 1.98 6000 Sweater 5 49.99 7000 Jacket 1 85.95
Program Menu
1. Pants 2. Jeans 3. Shirt 4. Dress 5. Socks 6. Sweater 7. Jacket
8. Clear Cash Register 9. Show Inventory 10. Check Out
def main():
retail = Retail_Item()
test = Cash_Register()
test.data(retail.get_item_number(),\
retail.get_description(),\
retail.get_unit_in_inventory(),\
retail.get_price())
answer = 'n'
while answer == 'n' or answer == 'N':
test.Menu()
print()
print()
Number =
int(input("Enter the menu number of the item \
you would like to purchase: "))
if Number == 8:
test.show_items()
else:
test.purchase_item(Number)
answer = input("Are you
ready to check out <Y/N>?")
x = 1
while x == 1:
if answer == 'y' or answer == 'n':
x = 0
else:
print("Invalid input!")
answer = input("Are you ready to check out <Y/N>?")
else:
test.get_total()
test.clear()
class Retail_Item:
def __init__(self):
self.__item_number =
[1000,2000,3000,4000,5000,6000,7000]
self.__description =
['Pants','Jeans','Shirt',\
'Dress','Socks','Sweater','Jacket']
self.__unit_in_inventory
= [10,2,15,3,50,5,1]
self.__price = [19.99,
25.95, 12.50, 79.00, 1.98, 49.99, 85.95]
def get_item_number(self):
return
self.__item_number
def get_description(self):
return
self.__description
def get_unit_in_inventory(self):
return
self.__unit_in_inventory
def get_price(self):
return self.__price
class Cash_Register:
def __init__(self):
self.__item_number_list
= []
self.__description_list
= []
self.__unit_list =
[]
self.__price = []
self.__total_item_number
= []
self.__total_des =
[]
self.__total_price =
[]
self.__sub_total = 0
def data(self,list1,list2,list3,list4):
self.__item_number_list
= list1
self.__description_list
= list2
self.__unit_list =
list3
self.__price = list4
def Menu(self):
print("1. Pants")
print("2. Jeans")
print("3. Shirt")
print("4. Dress")
print("5. Socks")
print("6.
Sweater")
print("7. Jacket")
print("8. Show
Inventory")
def purchase_item(self,Number):
self.__total_item_number.append(self.__item_number_list[Number-1])
self.__total_des.append(self.__description_list[Number-1])
self.__total_price.append(self.__price[Number-1])
if
self.__unit_list[Number-1] - 1 >= 0:
self.__unit_list[Number-1] = self.__unit_list[Number-1] - 1
else:
print("The item is out of stock")
def show_items(self):
print('Item
Number','{:>18}'.format('Description'),\
'{:>24}'.format('Units in inventory'),\
'{:>11}'.format('Price'))
for a in
range(0,7):
print('
','{:<17}'.format(self.__item_number_list[a]),\
'{:<20}'.format(self.__description_list[a]),\
'{:<15}'.format(self.__unit_list[a]),\
'{:>8}'.format(format(self.__price[a],'.2f')))
def get_total(self):
print('Item
Number','{:>18}'.format('Description'),\
'{:>19}'.format('Price'))
for a in
range(0,len(self.__total_item_number)):
print('
','{:<17}'.format(self.__total_item_number[a]),\
'{:<18}'.format(self.__total_des[a]),\
'{:>9}'.format(format(self.__total_price[a],'.2f')))
print()
print()
self.__sub_total =
sum(self.__total_price)
tax = self.__sub_total *
0.0825
total_price =
self.__sub_total * 1.0825
print('{:<12}'.format('Sub Total:'),\
'{:>10}'.format(format(self.__sub_total,'.2f')))
print('{:<12}'.format('Tax:'),\
'{:>10}'.format(format(tax,'.2f')))
print('{:<12}'.format('Total Price:'),\
'{:>10}'.format(format(total_price,'.2f')))
def clear(self):
self.__total_item_number
= []
self.__total_des =
[]
self.__total_price =
[]
input('Press any key to
continue')
main()
in python Write a class named RetaiI_Item that holds data about an item in a retail...
Write a class named RetailItem that holds data about an item in a retail store. The class should store the following data in attributes: item description, unit sold, units in inventory, and price. Once you have written the class, write a program that creates 5 RetailItem objects and stores the following data in them: Description Units Sold Units in Inventory Price Item #1 Jacket 20 12 59.95 Item #2 Designer Jeans 150 40 34.95 Item #3 Shirt 230 20 24.95...
4. RetailItem Class Write a class named RetailItem that holds data about an item in a retail store. The class should have the following fields: • description. The description field references a String object that holds a brief description of the item. • unitsOnHand. The unitsOnHand field is an int variable that holds the number of units currently in inventory. • price. The price field is a double that holds the item’s retail price. Write a constructor that accepts arguments...
Python 3 Question: All I need is for someone to edit the program with comments that explains what the program is doing (for the entire program) def main(): developerInfo() #i left this part out retail = Retail_Item() test = Cash_Register() test.data(retail.get_item_number(), retail.get_description(), retail.get_unit_in_inventory(), retail.get_price()) answer = 'n' while answer == 'n' or answer == 'N': test.Menu() print() print() Number = int(input("Enter the menu number of the item " "you would like to purchase: ")) if Number == 8: test.show_items() else:...
Programming Assignment 6: Object Oriented Programming Due date: Check Syllabus and Canvas Objectives: After successfully completing this assignment, students will practice Object Oriented design and programming by creating a Java program that will implement Object Oriented basic concepts. RetailItem Class: Part 1: Write a class named RetailItem that holds data about an item in a retail store. The class should have the following fields: • description. The description field references a String object that holds a brief description of the...
USE C++. Just want to confirm is this right~? Write a class named RetailItem that holds data about an item in a retail store. The class should have the following member variables: description: A string that holds a brief description of the item. unitsOnHand: An int that holds thw number of units currently in inventory. price: A double that holds that item's retail price. Write the following functions: -appropriate mutator functions -appropriate accessor functions - a default constructor that sets:...
must be in python Part 1 - the Item class – An Item object will represent one grocery item. Define a class named Item that has the following attributes: name – the name of the grocery item price – the price of the item quantity – the number of items that are needed The Item class should have an __init__ method for creating an Item object. The __init__ method should accept parameters which provide initial values for the object: ...
Week 6: Lab Overview TABLE OF CONTENTS Lab Overview Scenario/Summary Write a windows console application that holds data about an item in a retail store. Your class should be named RetailItem and should hold data about an item in a retail store. The class will have the following member variables. Description - string holding the description of the item, unitsOnHand - int that holds the number of units in inventory Price - double that holds the price of the item...
Write a Gui programming by using JavaFx menus, stage and screen
concepts to the RetailItem class,
Write a class named Retailltem that holds data about an item in a retail store. The class should have the following fields description: The description field is a String object that holds a brief description of the item . unitsOnHand: The unitsOnHand field is an int variable that holds the number of units currently in inventory Price: The price field is a double that...
Using Python, Write a class named Scores. This data structure will store a collection of lab scores (or programs scores or any other collection of scores). Since numbered assignments generally start with 1 – your first assignment this summer was lab 1 – the user of this class will think of this collection as being a 1-based list of values. All the methods which require a lab number will assume that value is based upon what the user sees, a...
Need this program in C#.
Thank you
3/19 Lab11 PartC Dur Scenario/Summary Write a windows console application that holds data about an item in a retail store. Your class should be named Retailltem and should hold data about an item in a retail store. The class will have the following member variables. Description- string holding the description of the item, unitsOnHand - int that holds the number of units in inventory Price - double that holds the price of the...