These example programs were done in class. They are less well documented than the regular CS 151 Demos.

- CapGainsTax.java. Compute the capital gains tax due on the sale of an asset. Uses lots of ifs and if-elses.
- RollEm.java. Simulate rolling a pair of dice ten times using a for loop.
- DiceMatching.java. Simulate rolling a pair of dice until the two dice agree. Uses a flag controlled while loop.
- DiceGameDemo.java. Simulate the great American game of craps.
- Ulam.java. Test Ulam's conjecture. Uses while loops, ifs and elses, and command line arguments.
- SumSquares.java. Sum the squares of the integers from 1 to N using a for loop. Get the value of N from the user.
- Average.java. Calculate the average on N grades. The value of N and the individual grades are obtained from the user.
- PythagComp.java. Calculate the hypotenuse of several right triangles using our own method.
- PythagApplet.java. An Applet to calculate the hypotenuse, side C, of a right triangle, given sides A and B. The user enters A and B in text fields, and then clicks a button to do the calculation.
- SumSquaresApplet.java. An Applet version of SumSquares.java.
- TossEmApplet.java. A coin tossing Applet where we toss a pair of coins 1000 times and record the number of times we get 0, 1 or 2 heads in a FREQUENCY ARRAY.

This page is best viewed with Netscape Navigator.