title: Create a CashRegister class that is used with RetailItem class
body: <p>Create a CashRegister class that can be used with the RetailItem class.  The CashRegister class should be able to internally keep a list of RetailItem objects.  The class should have the following methods:</p>
  
  <p>•   A method named purchase_item method that accepts a RetailItem object as an argument. Each time the purchase_item method is called, the RetailItem object that is passed as an argement should be added to the list.
  •   A method name get_total that returns the total price of all the RetailItem objects stored in the CashRegister object’s internal list.
  •   A method name show_items that displays data about the RetailItem objects stored in the CashRegister object’s internal list.
  •   A method named clear that should clear the CashRegister object’s internal list.</p>
  
  <p>Demonstrate the CashRegister class in a program that allows 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.</p>
  
  <pre><code>class RetailItem:
  
      # The __init__ method initializes the attributes.
      def __init__(self, item, units, price):
          self.__item = item
          self.__units = units
          self.__price = price
  
      # The following methods are mutators for the class.
      def set_item(self, item):
          self.__item = item
      def set_units(self, units):
          self.__units = units
      def set_price(self, price):
          self.__price = price
  
      # The following methods are accessors for the class.
      def get_item(self):
          return self.__item
      def get_units(self):
          return self.__units
      def get_price(self):
          return self.__price
  
      # The __str__ method returns the object's state as a
      #   string.
      def __str__(self):
          return 'Item Description:' + self.__item, \
                '\tNumber of Units:' + self.__units, \
                '\tPrice: $' + self.__price
  
      # The decrementInventory function decreases the number
      #   units each time called.
      def decrementInventory(units):
          if units &gt; 0:
              units -= 1
          else:
              units = 0
  # EOF
  </code></pre>
  
  <p>I believe this RetailItem class is correct and there is no need</p>
  
  <pre><code>class CashRegister:
  
      # The __init__ method initializes the attributes.
      def __init__(self, purchase_item):
          self.__purchase_item = []
  
      def purchase_item(item, units):
          purchase_item.append(item)
          decrementInventory(units)
  
      def get_total(price):
          total += price
          return total
  
      def show_items(item_list):
          for item in item_list:
              print(item.get_item())
              print(item.get_units())
              print(item.get_price())
              print()
  
      def clear():
          purchase_list [:] = []
  # EOF
  </code></pre>
  
  <p>I am not sure if I have this coded properly for the requirements.<br>
  Req. A CashRegister object has one attribute, which initialized as an empty list and write the other four methods as previously mentioned.
  For the program:
   The main method, create 3 retail objects, then initialize a CashRegister object for the user.  Write a method to display information on the retail items created, (call <strong>str</strong> method).  </p>
  
  <p>The following code is what I started with and I am having problems with the four methods from the CashRegister class.</p>
  
  <pre><code>import retail_item
  import cash_register
  
  SHOW = 1
  PURCHASE = 2
  CART = 3
  TOTAL = 4
  EMPTY = 5
  QUIT = 6
  
  def main():
      mylist = make_list()
      mycashregister = cash_register.CashRegister(mylist)
  
      choice = 0
  
      # Process menu selections until user quits program.
      while choice != QUIT:
          # Get the user's menu choice.
          choice = get_menu_choice()
          # Proces the choice.
          if choice == SHOW:
              __str__(item)
          elif choice == PURCHASE:
              purchase()
          elif choice == CART:
              cart(mycashregister)
          elif choice == TOTAL:
              total(mycashregister)
          elif choice == EMPTY:
              empty(mycashregister)
  
  def make_list():
      item_list = []
  
      item = 'Jacket'
      units = 12
      price = 59.95
      entry = retail_item.RetailItem(item, units, price)
      item_list.append(entry)
  
      item = 'Jeans'
      units = 40
      price = 34.95
      entry = retail_item.RetailItem(item, units, price)
      item_list.append(entry)
  
      item = 'Shirt'
      units = 20
      price = 24.95
      entry = retail_item.RetailItem(item, units, price)
      item_list.append(entry)
  
      return item_list
  
  # The get_menu_choice function displays the menu and gets
  #   a validated choice from the user.
  def get_menu_choice():
      print()
      print('CASH REGISTER MENU')
      print('-------------------------')
      print('1. Show Retial Items')
      print('2. Purchase an Item(s)')
      print('3. Show Current Shopping Cart')
      print('4. Show Total of Items Purchased')
      print('5. Empty Your Shopping Cart')
      print('6. Quit the program')
      print()
  
      # Get the user's choice.
      choice = int(input('Enter your choice: '))
  
      # Validate the choice.
      while choice &lt; SHOW or choice &gt; QUIT:
          choice = int(input('Enter a valid choice: '))
  
      # Return the user's choice.
      return choice
  
  def display_list(item_list):
      for item in item_list:
          print('Item Description:', item.get_item(), \
                '\tNumber of Units:', item.get_units(), \
                '\tPrice:', item.get_price())
      print()
  
  def purchase():
      item_purchase = input('Enter the item you wish to purchase: ')
  
  main()
  #not EOF more to come if I can figure out the first parts.
  </code></pre>
  
  <p>Any help would be appreciated.</p>