A7: Art-o-matic

On This Page


Overview

During this assignment, you will:

  • Create a class hierarchy for a drawing application
  • Create a driver for testing the drawing application
  • Automatically create colorful "artwork"

Background Information

A JFrame is a top-level window with a title, border and buttons for closing and iconifying the window. It contains a paint method that you can override to draw on the background of the JFrame

Specifications

Complete exercise 10.9 on page 502-504 of the textbook, drawing your Shapes in a JFrame. Use the starter code available here.

In addition to the requirements stated in the textbook, add a toString method callable from each subclass of MyShape. This method should return information about the type of object and the coordinates or size as appropriate. Call each Shape's toString() method just after you put the Shape into the array. Print the toString() information using System.out.println() method.

Sample Output

The call to each Shape's toString() method should produce an output similar to the following:

C:>java ArtOMatic
MyOval: x1 = 115, y1 = 137, width = 54, height = 191
MyRect: x1 = 208, y1 = 69, width = 59, height = 381
MyOval: x1 = 47, y1 = 253, width = 286, height = 117
MyLine: x1 = 152, y1 = 223, x2 = 273, y2 = 327
MyOval: x1 = 70, y1 = 291, width = 350, height = 185
MyLine: x1 = 109, y1 = 25, x2 = 447, y2 = 260
MyRect: x1 = 431, y1 = 447, width = 286, height = 239
MyRect: x1 = 349, y1 = 458, width = 41, height = 114
MyOval: x1 = 367, y1 = 260, width = 156, height = 218
MyRect: x1 = 251, y1 = 277, width = 76, height = 156
MyOval: x1 = 60, y1 = 317, width = 208, height = 230
MyLine: x1 = 265, y1 = 426, x2 = 215, y2 = 46
MyRect: x1 = 283, y1 = 413, width = 42, height = 199
MyOval: x1 = 288, y1 = 107, width = 66, height = 273
MyOval: x1 = 195, y1 = 159, width = 20, height = 76

Extra Credit

The following are worth extra credit points:

  1. Add random colors to the shapes. (1 point)
  2. Add another subclass to MyShape. (1 point)
  3. Create a set of tests for the classes. Your score for this extra credit will vary depending on the completeness of your test coverage. (1-3 points)

Make certain that your README.txt file lists any extra credit attempted.

Grading Criteria

The instructor will evaluate your assignment using the following criteria. Each criteria represents a specific achievement of your assignment and has a scoring guide. The scoring guide explains the possible scores you can receive.

Some scoring guides have a list of indicators. These indicators are a sign of meeting, or a symptom of not meeting, the specific criterion. Note that a single indicator may not always be reliable or appropriate in a given context. However, as a group, they show the condition of meeting the criterion.

For information on grading policies, including interpretation of scores, see the course Syllabus.

Program Compilation

  • 4: Source code compiles with no errors or warnings
  • 0: Does not compile

Functionality

  • 10: Demonstrates mastery of the assignment
    • Has extra features or demonstrates techniques beyond the assignment
    • Applies concepts from the lessons appropriately
    • Meets all specifications (see above) with particularly elegant solutions
    • No errors encountered during operation
  • 8: Has all the functionality expected of the assignment
    • Demonstrates many techniques from the lesson
    • Meets all specifications (see above)
    • Implementation seems more complicated than necessary.
    • May have one minor error
  • 6: Has most of the functionality expected of the assignment
    • Demonstrates some techniques from the lesson
    • Meets all but one of the specifications (see above)
    • Implementation seems excessively complicated.
    • May have 2-3 minor errors
  • 4: Has some of the functionality expected of the assignment
    • Demonstrates some techniques from the lesson
    • Meets at least 1/2 of the specifications (see above)
    • Implementation seems excessively complicated.
    • May have more than 3 minor errors
  • 2: Serious functional problems but shows some effort and understanding
    • Meets less than 1/2 of the of the specifications (see above)
    • Has a major error or many minor errors
    • Implementation seems very convoluted
    • Demonstrates few techniques from the lesson
  • 0: Does not execute

Program Style

  • 4: Code is well-documented
  • 3: Code has minor documentation errors
    • Has 1 documentation error
  • 2: Code has some documentation errors
    • Has 2-3 documentation errors
  • 1: Code has many documentation errors
    • Has more than 3 documentation errors
  • 0: No apparent attempt to document code

README.txt File

  • 2: README.txt file submitted with specified information included
  • 1: README.txt submitted but some information was not included
  • 0: No README.txt submitted

Maximum Score: 20, plus extra credit

What to Turn In

Submit your assignment following the instructions for homework. Include the following items for grading:

  1. README.txt file
  2. All of your source code (i.e. .java files)
  3. Any other source code needed to make your program function

You must submit all the files needed to make your assignment function properly. Do not assume that the instructors has any files unless explicitly stated by the instructor. Your assignment must work as submitted.

Home | WebCT | Announcements | Schedule | Expectations | Syllabus
Help | FAQ's | HowTo's | Links

Last Updated: October 22 2003 @17:02:24