Class to keep track of vending machine conditions to instruct master mind. More...
Public Member Functions | |
| def | __init__ (self, state=0, last_key='', disp_next='', soda_selected='', balance=0, price=0, err_flag=0, disp_flag=0, soda_flag=0, balance_flag=0, change_flag=0, welcome_flag=0, key_pressed_flag=0, wait_for_key_flag=0, reset_flag=0 ##) |
| def | formatBalance (self) |
| Formats balance. More... | |
| def | formatPrice (self) |
| Formats price. More... | |
Public Attributes | |
| state | |
| last_key | |
| disp_next | |
| soda_selected | |
| balance | |
| price | |
| err_flag | |
| disp_flag | |
| soda_flag | |
| balance_flag | |
| change_flag | |
| welcome_flag | |
| key_pressed_flag | |
| wait_for_key_flag | |
| reset_flag | |
Class to keep track of vending machine conditions to instruct master mind.
| def lab01.Conditions.__init__ | ( | self, | |
state = 0, |
|||
last_key = '', |
|||
disp_next = '', |
|||
soda_selected = '', |
|||
balance = 0, |
|||
price = 0, |
|||
err_flag = 0, |
|||
disp_flag = 0, |
|||
soda_flag = 0, |
|||
balance_flag = 0, |
|||
change_flag = 0, |
|||
welcome_flag = 0, |
|||
key_pressed_flag = 0, |
|||
wait_for_key_flag = 0, |
|||
reset_flag = 0 ## |
|||
| ) |
| state | current state in fsm |
| last_key | last key pressed |
| disp_next | next thing to print to display |
| soda_selected | name of soda selected |
| balance | current balance |
| price | price of selected soda |
| err_flag | [1/0] error raised |
| disp_flag | [1/0] new thing to display |
| soda_flag | [1/0] a soda has been selected |
| balance_flag | [1/0] balance is suffient |
| change_flag | [1/0] change to be dispensed |
| welcome_flag | [1/0] display welcome message |
| key_pressed_flag | [1/0] a key has been pressed |
| wait_for_key_flag | [1/0] need to wait for key press |
| reset_flag | [1/0] ok to reset conditions |
| def lab01.Conditions.formatBalance | ( | self | ) |
Formats balance.
Format balance from cents to dollar amount string
| def lab01.Conditions.formatPrice | ( | self | ) |
Formats price.
Format price from cents to dollar amount string