next up previous
Next: What to turn in Up: CS1320 Homework 6 Previous: Top-down design

Your mission

Mr. Surd believes that he has declared (i.e., written prototypes for) all the functions needed for the program, and he has written code to fill in some of the corresponding function definitions. For the remaining functions, he simply copied their prototypes and inserted the comment // STILL TO BE IMPLEMENTED. You are to do the following.

1.
Obtain Mr. Surd's (incomplete) C++ source. You can do this by logging into one of the CS lab machines and copying file http://www.cs.trinity.edu/~joldham0/1320/hw/hw6/asciiArt.cc to your directory.

2.
Look for functions whose definitions consist of the comment // STILL TO BE IMPLEMENTED. Wherever you see this comment, replace it with code that implements the function as described by its prototype and the associated comments giving its precondition and postcondition.

For example, suppose the code included a function with the following prototype and comments:

	// precondition:  a and b are integers
	// postcondition:  return value is a+b
	int addTwoInts(int a, int b);
and the following definition:
	// precondition:  a and b are integers
	// postcondition:  return value is a+b
	int addTwoInts(int a, int b) 
	{
	    // STILL TO BE IMPLEMENTED
	}

Then you would replace the comment in the function definition with the following line:

	    return a + b;

You should not need additional functions, but if you do, put their prototypes and any other needed declarations after the comment

	// PLACE FOR ADDITIONAL DECLARATIONS
and their definitions after the comment
	// PLACE FOR ADDITIONAL CODE

Hint: Before beginning to write code, you should review other parts of Mr. Surd's code, especially the functions identified in the comments as ``Helper functions''. Mr. Surd's daughter Abby says she knows how to complete his program by adding only 45 additional lines of code. If you find yourself writing a lot more, you are probably doing something the hard way.

To help you: An executable for a sample solution is available in
/users/blm1320/ASCIIart/asciiArtSolution; you can execute this program to see how your program should behave. (You can execute it by logging into one of the lab machines and typing its full name as given above. You can also copy it to your own directory.)


next up previous
Next: What to turn in Up: CS1320 Homework 6 Previous: Top-down design

1999-10-19