1. Practice designing programs that use loops.
2. Practice choosing the appropriate kind of loop for a problem.
Your instructor will assign you one of the following projects, each of which uses loops controlled by conditions.
8.1. Write a program that will read a sequence of numbers from the keyboard, and display the minimum, maximum, average, and range of the entered values. Make the input step "foolproof".
8.2. Extend Calculate.java into a six-function calculator, as follows:
8.3. Write two "graphics" methods:
Use these methods to write a program that draws a picture, such as a flag. For example, you might use these methods to draw a crude facsimile of the U.S. flag that looks like this:
* * * * * * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX * * * * * * * * * * * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX * * * * * * * * * * * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX * * * * * * * * * * * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX * * * * * * * * * * * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Try and draw your picture efficiently (i.e., using loops to minimize the number of statements). Feel free to create additional "graphics" methods that simplify drawing your particular flag.
8.4. Build a "police sketch artist" program as described in Project 7.2, but write a dynamic program that lets the user experiment with different combinations of facial parts in a single execution. (Hint: Control the program using a loop. Start with a 'blank' face. Allow the user to modify this face using a two-level hierarchical menu, with the first level allowing the user to select which facial part they want to modify (i.e., a menu of menus), and the second level allowing the user to select from among the choices for that particular facial part.)
8.5. Use the Fraction class from lab 6 to create a "drill" program that generates random fractions (using class java.util.Random), that younger students can use to practice their fractional arithmetic.
Turn In: A hard copy of this grade sheet, attached to hard copies of
Don't forget to clean up your directory when you are all finished...
Back to the Lab Exercise
Back to This Lab's Home Page
Back to the Table of Contents
Back to the Introduction