package Snack_Machine is -- Simulation of a snack machine that hands out snacks which cost -- 2 EUR each. The machine accepts only the following coins (10 cents, 20 -- cents, or 50 cents) -- The machine outputs the snack immediately after the user has paid the -- required amount. Note that overspending is possible. -- -- The machine has an additional button "reset" to drop the coins. -- -- Interaction options for the user: -- - Insert coins (10 ct, 20 ct, or 50 ct) -- - Press reset to get the money back type State is private; type Action is (Insert_10_Ct, Insert_20_Ct, Insert_50_Ct, Reset); type Reaction is (Nothing, Reset, Output_Snack); procedure Initialize(S: out State); procedure Do_Action(S: in out State; User_Action: in Action; R: out Reaction); private type State is new Float range 0.0..2.0; end Snack_Machine;