wmbuck.net

The Awesome Java Soda Machine

Instructions:

If you don't see a soda machine to the right, your browser is not enabled for Java. Download java from Sun's java website.

Click "money" buttons to insert coins or dollar bills. Change is returned in the coin hopper. "Return" and "Amount Tendered" do what you would expect. When you have inserted enough the "select soda" lights up, and the soda selection buttons are active. Click your brand choice and enjoy a virtual soda.

When the "Ex Ch" light is green there is change, when it turns red the machine is low on change and may not accept certain coins. This is the most interesting part.

The check boxes turn on some debugging messages, which show up in the message window. The messages aren't very interesting.

When you are finished, click here to return to the home page.

Back in 1999, I felt I needed to learn java. I learn best by actually doing a non-trivial project. I remembered a problem that was given to students learning programming back in the bronze age: build a soda-machine which takes various coins, makes change, dispenses sodas, keeps track of whether there is more soda, and so forth.
I did this just as a learning exercise, using an old book I found, first in Java AWT, then switched to Swing, then discovered that neither Netscape nor IE would display a Swing based applet and rebuilt the whole thing in AWT again. Grump grump.