Computer Science 120
Introduction to Programming

Fall 2011, Siena College

Project 3: Abstract Art Generator
Date: Tuesday, November 2

Note: There are 110 points that can be earned, but the project is only graded out of 100. Thus, you should carefully manage your time to maximize the amont of credit.

Overview

Implement two classes: Triangle and StickFigure

Implement an interactive WindowController application that will draw triangles and stick figures to the canvas in three different patterns:

  1. Fill Pattern
  2. Border Pattern
  3. Random Pattern

To better understand the application, repeatedly click on the triangles and stick figures below to create an abstract art pattern.

Project 3 Demo

JavaDoc Style Documentation and Compilation [30 points]

All your code must include descriptive comments include JavaDoc style comments for all classes and methods. Specifically, be sure to do the following:

[5 points] Every class should have a top banner style comment that describes the details of the class and in addition

[5 points] Every field (class instance variable) should have a descriptive comment

[5 points] Every method (especially constructors) should have a banner style comment that describes the details of the method and in addition

[5 points] Complex code, such as loops and if statements should have descriptive comments.

[10 points] Compilation - If you have made a reasonable attempt and your code complies. A reasonable attempt implies that you have tried to implement all three patterns and at least one of the classes (Triangle or StickFigure).

Patterns Class (WindowController Application) [40 points]

Requirements:

You can test your patterns by using different sized ObjectDraw objects, i.e., FilledRect, FramedRect, FilledOval, FramedOval. And, you can gain up to 40 points of credit without using your own custom object (Triangle and StickFigure).

[12 points] Fill Pattern - Use a nested loop to copy and move the object from left to right until the right-side of the canvas is reached. Then, copy the object and move it down and then move it to the left-side of the canvas. Repeat the outer loop until the object reaches the bottom of the canvas

[12 points] Border Pattern - Use 4 loops. The first loop copies and moves the object from left to right until you reach the right-side of the canvase. The second copies and moves the object from top to bottom until you reach the bottom of the canvas. The third loop copies and moves the object from right to left until you reach the left-side of the canvas. And the fourth loop copies and moves the object from bottom to top until you reach a height of 100.

[12 points] Random Pattern - Use a random number generator and a for loop to random place 100 objects on the canvas. Be sure not to place any object above the height of 100.

[4 points] Random Color - Use a random number generator to change the color of the objects as they are generated. The border objects should all have the same random color, but the fill and random should each have a different random color.

Triangle Class [20 points]

Your Triangle class must implement all the methods described in the Triangle Documentation.

Read the documentation carefully as it includes all the instructions needed to implement the Triangle class.

To gain full credit, your Triangle class must be one of the object that can be selected by your Pattern class.

Note that a Triangle has 3 different constructors:

  1. The first takes six doubles, i.e., x- and y-coordinates of the three points
  2. The second takes three Location points
  3. And, the third takes another Triangle object and makes a copy of it, i.e., a copy constructor

StickFigure Class [20 points]

Your StickFigure class must implement all the method supported by your Triangle Class.

To gain full credit, your StickFigure class must be one of the objects that can be selected by your Pattern class.

Read the documentation of the Triangle class carefully as you must implement all these methods for your StickFigure class.

But, the StickFigure class should only have 2 constructors:

  1. The first constructor should take the x and y coordinates of where to draw the figure and the height. The width of the figure should be half the height. The diameter of the head should height/4. The body, arms and legs should be appropriately drawn based on the height and width.
  2. The second constructor take another StickFigure object and makes a copy of it, i.e, a copy constructor.