ME 405 Portfolio
Lab1.py File Reference

Vendotron Program. More...

Functions

def Lab1.on_keypress (thing)
 Callback which runs when the user presses a key. More...
 
def Lab1.getChange (price, payment)
 Computes change. More...
 
def Lab1.printWelcome ()
 Prints welcome message and states prices. More...
 

Variables

int Lab1.state = 0
 State flag. More...
 
 Lab1.pushed_key = None
 Pushed key storage. More...
 
int Lab1.your_money = 0
 Your bankroll. More...
 
int Lab1.cost = 0
 Drink cost. More...
 
int Lab1.your_bills = 0
 Your bills variable. More...
 
int Lab1.new_change = 0
 Your change. More...
 
int Lab1.drink = 0
 Drink storage. More...
 
int Lab1.eject_error = 0
 problem ejecting More...
 
int Lab1.eject_change = 0
 Ejected change value. More...
 
int Lab1.penny = 0
 Pennies. More...
 
int Lab1.nickel = 0
 Nickels. More...
 
int Lab1.dime = 0
 Dimes. More...
 
int Lab1.quarter = 0
 Quarters. More...
 
int Lab1.one = 0
 Ones. More...
 
int Lab1.five = 0
 Fives. More...
 
int Lab1.ten = 0
 Tens. More...
 
int Lab1.twenty = 0
 Twenties. More...
 

Detailed Description

Vendotron Program.

Program initializes and prompts you to insert money. It then takes your money and adds it to your balance while keeping track of how many of each denomination you have inserted. Once you choose a drink it will decide if you inserted enough money. If not, it will tell you that you have insufficient funds. If you do, it will subtract the cost of your drink and spit out your change in the form of how many of each denomination you are getting back, and tells you that it is dispensing your drink. At any point you can press eject and it will tell you that it is giving back your money and the the balance will clear and it will once again prompt you to insert money.

Author
Jacob Everest
Date
Jan. 14, 2021

Function Documentation

◆ getChange()

def Lab1.getChange (   price,
  payment 
)

Computes change.

Takes the payment denominations, multiplies them out to find their value, subtracts the value of the cost, and then does some division magic to determine the change denominations.

Parameters
pricethe cost of the drink
paymentthe value the user has entered
Author
Jacob Everest
Date
Jan. 14, 2021

◆ on_keypress()

def Lab1.on_keypress (   thing)

Callback which runs when the user presses a key.

Professor Ridgely gave us this and frankly I dont understand it

Parameters
thingit is a thing
Author
Jacob Everest
Date
Jan. 14, 2021

◆ printWelcome()

def Lab1.printWelcome ( )

Prints welcome message and states prices.

Its very simple. It prints a message. Then it state the price of each drink.

Parameters
nothingruns automatically
Author
Jacob Everest
Date
Jan. 14, 2021

Variable Documentation

◆ cost

float Lab1.cost = 0

Drink cost.

Storage for the cost of the drink that you selected

◆ dime

int Lab1.dime = 0

Dimes.

how many dimes you've input

◆ drink

int Lab1.drink = 0

Drink storage.

Stores the name of drink for later dispensing

◆ eject_change

int Lab1.eject_change = 0

Ejected change value.

Amount of change to be ejected after transaction

◆ eject_error

int Lab1.eject_error = 0

problem ejecting

If nothing was inserted and you want money

◆ five

int Lab1.five = 0

Fives.

how many fives you've input

◆ new_change

int Lab1.new_change = 0

Your change.

the amount of change you will get back after purchase

◆ nickel

int Lab1.nickel = 0

Nickels.

how many Nickels you've input

◆ one

int Lab1.one = 0

Ones.

how many ones you've input

◆ penny

int Lab1.penny = 0

Pennies.

how many pennies you've input

◆ pushed_key

Lab1.pushed_key = None

Pushed key storage.

where the key that was pushed

◆ quarter

int Lab1.quarter = 0

Quarters.

how many quarters you've input

◆ state

int Lab1.state = 0

State flag.

Changes depending on where vendotron needs to go next

◆ ten

int Lab1.ten = 0

Tens.

how many tens you've input

◆ twenty

int Lab1.twenty = 0

Twenties.

how many twenties you've input

◆ your_bills

tuple Lab1.your_bills = 0

Your bills variable.

The bills that will be used to purchase (your money in denom version)

◆ your_money

int Lab1.your_money = 0

Your bankroll.

How much money you've put in