Mechatronics
Documentation for ME 405 labs
Vendotron.State Class Reference

The current state of the Vendotron. More...

Static Public Member Functions

def initialize ()
 (Re)initialize the vendotron to its starting state. More...
 
def drink_select (drink)
 Dispense a drink if the balance is high enough, otherwise display the price. More...
 
def dispense_drink (drink)
 Dispense a drink. More...
 
def insert_currency (index)
 Insert one Currency into the Vendotron and display the current balance. More...
 
def eject ()
 Return the current balance to the user in the fewest number of coins possible. More...
 
def terminate ()
 Stop the Vendotron and exit the program.
 

Static Public Attributes

 message = None
 The message currently displayed.
 
 currencies = Currency.currency_list(0b111101011101)
 A list of acceptable Currencies.
 
 payment = None
 Frequencies of payments that have been made.
 
 balance = None
 Total balance.
 
bool RUNNING = False
 Indicates if the Vendotron is currently running.
 
 epoch = time.time()
 Timestamp of the state change.
 

Detailed Description

The current state of the Vendotron.

Member Function Documentation

◆ dispense_drink()

def Vendotron.State.dispense_drink (   drink)
static

Dispense a drink.

Dispense a drink and deduct the drink's cost from the balance. If there is any leftover prompt the user to buy another.

◆ drink_select()

def Vendotron.State.drink_select (   drink)
static

Dispense a drink if the balance is high enough, otherwise display the price.

Parameters
drinkThe drink to attempt to purchase

◆ eject()

def Vendotron.State.eject ( )
static

Return the current balance to the user in the fewest number of coins possible.

Returns
A dictionary containing quantities of each currency where keys are the currency value and values are the frequency of each denomination.

◆ initialize()

def Vendotron.State.initialize ( )
static

(Re)initialize the vendotron to its starting state.

Set the frequency of all payments and balance to zero, display the welcome message, and set RUNNING to True.

◆ insert_currency()

def Vendotron.State.insert_currency (   index)
static

Insert one Currency into the Vendotron and display the current balance.

Parameters
indexThe index in the currencies list of which currency is being inserted

The documentation for this class was generated from the following file: