CSCI 201 Spring 2003

Programming Project 3

In this assignment, you will work a modification of problem 4.11 on page 266 of your text. Rather than asking you to develop the Crayon class on your own, we are giving you a partially written implementation of that class. Download Crayon.java and complete the code by adding a class constructor.

After completing the Crayon class, use that class to construct an applet displaying a box of crayons similar to the one shown below.

Of course, you are encouraged to improve on the box of crayons displayed above. The crayons may be of any color and dimensions you choose, but there are certain requirements that you must meet:

Here are a couple of hints that may help you get started. After you have completed the Crayon class, begin your applet by drawing one crayon. Then make a loop that draws one row of crayons. Note that you will need to use a conditional statement inside of the loop to set a different color for each crayon (or perhaps call a method that does that job).

Programming Style

Note that 10% of your program grade is based on the readability of your program. This includes things like proper indentation, comments, and the naming of variables and methods as described in the style guide for this class. To receive full credit for your program, make sure that you use proper indentation as demonstrated in your text and in class room examples. Also include comments at the top of each program stating your name, the course, and the purpose of the program: For example:

/*
** Name: your name here 
** 
** Course: CSCI 201 
** 
** Purpose: purpose of program here 
*/

Submitting Your Program

The program written for this assignment must be turned in by transferring the java source code file and the HTML file to your ftp directory for this class. Both the source code file (i.e., CrayonBox.java) and the HTML file (CrayonBox.html) should be turned in and the files must have exactly those names. You were shown how to transfer files to your class ftp directory in lab 1.