Interfaces Assignment

See this link for Assignment Policies, Submission Instructions, and Grading Guidelines.

Instructions

1.      Write a Java applet that draws five (5) versions of the same character (creature, thing, figure, robot, cartoon, etc.) of your own creation. Use the following guidelines:

2.      Each individual character should be made up of at least 5 different shapes.

3.      The shapes can be of the same class. For example, your character may consist of 5 Rectangles. Please make sure by your drawing that it is clear that you have used 5 different shapes to create your character. Be creative!!!

4.      Copy & paste the Drawable.java code (omit the keyword “public”) into your program file. Do not make any changes to this code.

5.      Copy & paste the DrawMethods.java code (omit the keyword “public”) into your program file. Do not make any changes to this code.

6.      Class definition: Write a class definition for your character.

7.      Class definition: The class definition should implement the interface Drawable. This is done on the first line of code for your class definition. Take a close look at the first line of my example class definition in the file Kurochan.java, but do not copy this code into your program file.

8.      Class definition: Your character should have at least 3 data fields. The data fields should be the Graphics window and the x & y coordinates. (Optional: vary the size & color of your character as well by adding Integer & Color data fields.)

9.      Class definition: Write a constructor for your character. The constructor should have one parameter for class Graphics, which is for the graphics window on which you draw shapes. The other parameters should be the x & y coordinates, which are class Integer. You can use as many x & y coordinates as you need. (Optional: vary the size & color of your character as well by adding Integer & Color parameters.)

10.  Class definition: Write the draw() method for your character. Write the code that actually draws the characters here.

11.  Applet’s paint() method: Create the 5 characters by using the constructor that you have written. For example, see my example Applet KurochanClientApplet.java, but do not copy this code into your program file.

12.  Applet’s paint() method: Draw the 5 characters by using the static method call shown below. (Copy & paste this one line of code into your program file, and make any changes to the variable names that are necessary.)
DrawMethods.draw5(character1, character2, character3, character4, character5);

13.  HTML code: See kurochan.html and kurochan.html.txt for example HTML code.

14.  Note that you will have 4 classes in your LastNameFirstNameX.java program file. So compiling your file will create 4 .class files! All of these .class files need to be posted on your UHUNIX account in order for your applet to work; however, your APPLET CODE only needs to link to ONE class file: "LastNameFirstNameX.class".

15.  When you submit your program, you need to include the link to your HTML page that displays your applet.

                                             

 

 

© 2007 William Albritton