CS 2510
Assignment 2
Dr. Woelfl
The purpose of assignment two is to gain practice with
constructing tests for if statements and to take the
time thinking about code before typing rather than using
“trial and error” to produce code.
Download the listing for
the code given in class and revise it to produce the following bitmap image:

Write your code so that each object has just one test to
determine if a pixel is within that particular object.
Descriptions of the objects from front to back are:
- Yellow
triangle has height of one-half the image height, forty-five degree sides,
and centered with respect the width.
- Blue
circle has radius of one-fourth the image height with the center at the
center of the image; the color varies with radial distance, from white at
the center to blue at the edge.
Avoid using the square root
function; stay with integer math!
- Red
circle has a radius of one-half the width with the center at two-thirds
the height from the top edge and at the right edge; the color varies
uniformly with the vertical distance, from red at the center to
white at the top and bottom.
- Green
circle has radius of two-thirds the image height with the center at the
upper left corner of the image.
- Background
is white.
Do several runs using different values for width and
height. Hand in a copy of your code for
the tests along with B&W copies of three runs using different heights
and widths; the assignment is due at the beginning of class on Thursday of week
four.