See this link for Assignment
Policies, Submission Instructions, and Grading Guidelines.
1. This is a continuation of the last assignment with the additional instructions in blue.
2. Write a Java applet that draws five (5) versions of the same character (creature, thing, figure, robot, cartoon, etc.) of your own creation, and also draws five (5) more versions of a more complex character, which is based on the original character. Use the following guidelines:
3. Each individual character should be made up of at least 5
different shapes.
4. 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!!!
5. Copy & paste the Drawable.java code (omit the keyword “public”) into
your program file. Do not make any changes to this code.
6. Copy & paste the DrawMethods.java code (omit the keyword “public”) into
your program file. Do not make any changes to this code.
7. Class definition: Write a class definition for your
character.
8. 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.
9. 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.)
10. 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.)
11. Class definition: Write the draw()
method for your character. Write the code that actually draws the characters
here.
12. 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.
13. 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);
14. Class definition: In the original Superclass Character,
change the keyword “private” to “protected” for all
the data fields.
15. Second class definition: Create a Subclass Character, which
is a Subclass of the Superclass Character.
16. Second class definition: The Subclass Character should add
at least 5 different shapes to the original Superclass Character.
17. Second class definition: In the Subclass Character, you need
both a constructor & a draw method. Both the constructor & draw method
should call the Superclass’s constructor & draw
method at the beginning of these methods. Use the keyword “super” to do this.
18. Second class definition: Write the draw()
method for your character. Write the code that actually draws the characters
here. You should also call the superclass’s draw
method using the code below.
super.draw();
19. Applet’s paint() method: Create the
5 Subclass Characters by using the constructor that you have written.
20. Applet’s paint() method: Draw the 5
Subclass Characters by using the static method call below.
DrawMethods.draw5(character1, character2, character3, character4, character5);
21. Applet’s paint() method: In short, your Applet should
display a total of 5 Superclass Characters (consisting of 5 distinct shapes)
& 5 Subclass Characters (consisting of 10 distinct shapes, with 5 of those
shapes being the same as the Superclass’s 5 shapes).
22. HTML code: See kurochan.html and kurochan.html.txt for example HTML code.
23. Note that you will
have 5 classes
in your LastNameFirstNameX.java program file. So
compiling your file will create 5 .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 the one class file "LastNameFirstNameX.class".
24. When you submit your program, you need to include the link to your HTML page that displays your applet.
© 2007 William Albritton