CS 455 - Programming Assignment 1

This assignment is about 2D graphics programming in Java. You are to write a Java application that duplicates the following Java applet. Repeatedly click on the green polygon to make it "grow". The small slider changes the slope of the slanted "roof" of the five sided polygons.

Download this zip file. In the zip file you will find a skeleton Java program called CS455Hw1.java. There is also a compiled version of the solution, CS455Hw1Solution.class, that you can run so that you can see what the solution is supposed to look like as an application.

Here are some pages from the Java API that you might find useful.

To help you get started with graphics programming in Java, here is a Java applet that draws a "Sierpinski triangle". This is a fairly simple fractal image. It is defined by taking a triangle, dividing the triangle into four sub-triangles (by bisecting each of the three sides of the original triangle) and then recursing on three of the four sub-triangles (the three which have a vertex in common with the original triangle). Click repeatedly on the triangle below to watch how a Sierpinski triangle is built up. Also see Example 2.2.2 (pages 52-55) from our course textbook.

Look at the source code to see how the graphics is being drawn and how the events (e.g.. mouse clicks and mouse overs) are handled.

Turn in a zip file called CS455Hw1Surname.zip containing your Java program.

This assignment is due Monday, January 31.


Return to the main homework page.
Return to the CS 45500 home page.


compliments and criticisms