cs106a – Assignment #2 – Task #2

Suppose that you’ve been hired to produce a program that draws an image of an archery target—or, if you prefer commercial applications, a logo for a national department store chain—that looks like this:

cs106a – assignment #2 – task #2

This figure is simply three GOval objects, two red and one white, drawn in the correct order. The outer circle should have a radius of one inch (72 pixels), the white circle has a radius of 0.65 inches, and the inner red circle has a radius of 0.3 inches. The figure should be centered in the window of a GraphicsProgram subclass.

To draw a circle create an oval with using the diameter (twice the radius), and place it at the given position:
Continue reading “cs106a – Assignment #2 – Task #2”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs106a – Assignment #2 – Task #1

Write a GraphicsProgram subclass that draws a pyramid consisting of bricks arranged in horizontal rows, so that the number of bricks in each row decreases by one as you move up the pyramid, as shown in the following sample run:

cs106a – assignment #2 – task #1

The pyramid should be centered at the bottom of the window and should use constants for the following parameters:

   BRICK_WIDTH    The width of each brick (30 pixels)
   BRICK_HEIGHT   The height of each brick (12 pixels)
   BRICKS_IN_BASE The number of bricks in the base (14)

The numbers in parentheses show the values for this diagram, but you must be able to change those values in your program.

Continue reading “cs106a – Assignment #2 – Task #1”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail