Computer Science I

MC140.01 / MC140.02

Fall 2000

Assignment 2

due Monday 25 September 2000, 12noon

The goal of this assignment is to reinforce use of formatted input and output and to practise using functions and some math. This assignment is worth 2% of your term mark. It will be marked out of 20 points.

1. Basic program. (10 points)
Write a program that draws shapes based on input from the user. Your program should print a menu, something like this:

[1] rectangle
[2] triangle
[3] quit
enter option:
Based on the option entered by the user, your program should call a function to print out the requested shape.

2. First extension. (4 points)
Before drawing each shape, let the user specify a size. For example, the user could enter the width and height of the rectangle.

3. Second extension. (3 points)
Add another option to draw a circle. Let the user specify the radius of the circle.

4. Third extension. (3 points)
Add another option to draw another shape you can think of. Let the user specify dimensions of that shape.

5. Submit your ".c" file electronically, as with assignment 1.

6. Tips.