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... | |
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.
| 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.
| price | the cost of the drink |
| payment | the value the user has entered |
| 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
| thing | it is a thing |
| def Lab1.printWelcome | ( | ) |
Prints welcome message and states prices.
Its very simple. It prints a message. Then it state the price of each drink.
| nothing | runs automatically |
| float Lab1.cost = 0 |
Drink cost.
Storage for the cost of the drink that you selected
| int Lab1.dime = 0 |
Dimes.
how many dimes you've input
| int Lab1.drink = 0 |
Drink storage.
Stores the name of drink for later dispensing
| int Lab1.eject_change = 0 |
Ejected change value.
Amount of change to be ejected after transaction
| int Lab1.eject_error = 0 |
problem ejecting
If nothing was inserted and you want money
| int Lab1.five = 0 |
Fives.
how many fives you've input
| int Lab1.new_change = 0 |
Your change.
the amount of change you will get back after purchase
| int Lab1.nickel = 0 |
Nickels.
how many Nickels you've input
| int Lab1.one = 0 |
Ones.
how many ones you've input
| int Lab1.penny = 0 |
Pennies.
how many pennies you've input
| Lab1.pushed_key = None |
Pushed key storage.
where the key that was pushed
| int Lab1.quarter = 0 |
Quarters.
how many quarters you've input
| int Lab1.state = 0 |
State flag.
Changes depending on where vendotron needs to go next
| int Lab1.ten = 0 |
Tens.
how many tens you've input
| int Lab1.twenty = 0 |
Twenties.
how many twenties you've input
| tuple Lab1.your_bills = 0 |
Your bills variable.
The bills that will be used to purchase (your money in denom version)
| int Lab1.your_money = 0 |
Your bankroll.
How much money you've put in