CS 117 Assignment, Due noon 5/1/96

Patches

Hand in via HSP. You may work with a partner.

Your goal is to write two procedures, each of which will draw a picture within a rectangle specified by the procedure's parameters.

To get started, you should run a program of mine. Execute it by typing

/Accounts/courses/old-courses/cs117-w95/patch

in response to the Unix prompt. Run this program a bunch of times, trying various values for the input. What does my picture look like if you give it a tall skinny rectangle? A square? A big rectangle? A little one?

Your job is to write two procedures.

  1. A procedure that will draw the same picture that the program "patch" draws (you may change the colors).
  2. A procedure that will draw any picture you wish.

In both cases, you must draw a line around the outside of the given rectangle, and your picture may not slop outside that line.

Your procedures should begin with the following:

procedure DrawPicture( left, bottom, width, height : integer );

You may change the name DrawPicture, but you may not change the number or meaning of the parameters. The parameters left, bottom, width, and height, refer to coordinates within the current window, which DrawPicture should assume has been opened by the calling routine. Your DrawPicture must not call createwindow, and it also must not call write, writeln, read, or readln.

Once they are done, I intend to put all your patches together into an on-screen quilt. If you do not follow the restrictions above (staying inside the given rectangle, using parameters properly, and avoiding read, write, and createwindow), the quilt won't work.

Start early, have fun, and stay in touch.



Jeff Ondich, Department of Mathematics and Computer Science, Carleton College, Northfield, MN 55057
(507) 663-4364, jondich@carleton.edu