Vending Machine




Overview

Your company has been contracted to provide the core logic for a new vending machine. This logic will be integrating the sub-systems of the vending machine, whose interfaces are already well defined.The integration will be bringing together the functionality of the Pricing System, Cashier System and Inventory Management System.

Your assignment is to lead your partner to write the following methods by communicating through test code: (feel free to copy and paste the method definitions)



      • Pricing.get_price(row,column)



      • Cashier.get_money()



      • Cashier.get_money()
      • Cashier.get_available_change()



      • Inventory.empty(row,column)



      • Pricing.get_price(row,column)
      • Cashier.get_money()
      • Cashier.get_available_change()
      • Cashier.dispense_change(quarter_count, dime_count, nickel_count)
      • Inventory.empty(row,column)
      • Inventory.dispense(row, column)

Pricing

The pricing system is the index of item prices in our vending machine, and can be thought of as little more than a 2 dimensional array of prices, supplied by the vending machine owner. To aid in usability, this array is accessed through a method:

  • Pricing.get_price(row,column)
    • Accepts the row and column entered by the consumer.
      • row is character between “A” and “Z”.
      • column is an unsigned integer between 0 and 63.
    • Returns the price of the specified product as a float.

Cashier

The Cashier system accepts money and dispenses change. Your system will use it to find out how much money the consumer has put in to the machine. Your system will also tell it how much change to dispense, and in what denominations.

  • Cashier.get_money()
    • Returns a float representing the current amount of money that the consumer has put in to the vending machine
  • Cashier.get_available_change()
    • Returns an array with corresponding quantities of Quarters, Dimes and Nickels.
      ([40,30,60] would then be 40 Quarters, 30 Dimes and 60 Nickels)
  • Cashier.dispense_change(quarter_count, dime_count, nickel_count)
    • Dispenses the quantity of change as directed.

Inventory


The inventory system dispenses product, and detects when product is out.

  • Inventory.empty(row,column)
    • Accepts the row and column of the requested item within the inventory system
    • Returns: True if there is a dispenser at the inventory location AND that dispenser is empty, and will otherwise return false.
  • Inventory.dispense(row, column)
    • Dispenses product
    • Accepts the row and column of the requested item within the inventory system
    • Returns: nothing


Go To Editor