CS215

Assignment #3 (Second Programming Project)

DUE: Thursday, October 2.

Write an applet to simulate a "slot machine". The machine should have a button and (at least) three text fields in it. When you hit the start button, numbers start counting in each of the three windows (seemingly independently). When you hit the button again, the numbers will stop counting (again, apparently independently) and if they are all the same, the applet will announce if you have "won" and otherwise that you have lost. To see what I mean, here's what your applet might look like in the end:



It should be clear that threads are appropriate for this! In fact, the program CounterWithThread.java should prove quite useful to you as a starting point (you will also need WindowDestroyer.java to make it work; it's implemented as an application not an applet). One difference is that CounterWithThread.java creates one thread object; here you will most likely need three, one for each of the counter windows.

Back to CS215 Home Page