Wallpaper Programming Assignment

Functions with Value-Passed Parameters

Overview
In this assignment you will design and code a scalable picture, similar to the house in the Villages program. (I hope your picture will be much more interesting than this simple house. ) You will then use your picture to make wallpaper patterns.

Goals

Activities
Copy the Wallpaper folder.
Run the application program Wallpaper.
Use the project Wallpaper.mu and shell Wallpaper.cp to write your code.

Design your own scalable picture function.
You must draw your picture in terms of x, y, width, and height.

Write the body of the Wallpaper function.
Introduce variables width and height.

width  = 400 / NumAcross;  // window is 400 wide
height = 400 / NumDown;    // window is 400 high
Write a double for loop to fill the window with NumAcross by NumDown copies of your picture.

Turn in:
A printed copy of your source code.
A diskette with
your source code (Wallpaper.cp)
your project (Wallpaper. )
your application (Wallpaper).

Due: At your next lab class: Tuesday or Wednesday, October 14 or 15.

The House:

void House(int x, int y, int width, int height)
{		// Draws a house with lower left corner (x,y)
		// and given width and height
int baseTop = y - 2*height/3; // top of the bottom of house, base of roof

PaintRect(x, y, x + width +1, baseTop); // bottom of the house
 					// the +1 makes roof fit better

int midx = x + width/2;              		// halfway across the house
DrawLine(x , baseTop, midx, y - height);     	// left side of roof
DrawLine(x + width, baseTop, midx, y - height);	// right side of roof
} 

Last Updated: October 3, 1997 10:11 pm by

Harriet Fell
College of Computer Science, Northeastern University
360 Huntington Avenue #161CN,
Boston, MA 02115
Internet: fell@ccs.neu.edu
Phone: (617) 373-2198 / Fax: (617) 373-5121
The URL for this document is: http://www.ccs.neu.edu/home/fell/COM1100/HW/Wallpaper.html