If you had to program a functioning vending machine, what inputs and outputs would you have to include in your machine? How would you design the machine to use these variables?
Anonymous
I said that the inputs would include the user's choice of snack/beverage and coins/money inserted and the outputs would be the amount of change and if the snack/beverage should be dispensed or not. The amount of money inserted would be an input variable that would be compared the user's choice of snack/beverage cost. If the money inserted = cost of snack/beverage, the outputs would be a 1 (yes) for dispensing the snack and zero for change. If money inserted is more than cost of snack, the snack is dispensed but output of change is money inserted minus cost. If money inserted is less than cost of snack, outputs would be 0 (no) for snack dispensed, and change would be equal to money inserted.
Check out your Company Bowl for anonymous work chats.