next up previous
Next: Top-down design Up: CS1320 Homework 6 Previous: Problem description

User interface

Conceptually, an ASCII-art picture is a two-dimensional grid, nuColumns columns wide and nuRows rows tall. (For the equipment Mr. Surd is using, reasonable values are nuColumns = 80 and nuRows = 24.) Each point in the grid is identified by its x-y coordinates (where the upper left corner has x=0 and y=0, and the lower right corner has x= nuColumns - 1 and y= nuRows - 1). Each point also has an associated character, which can be any text character, including a space. For example, in a completely blank picture, the character for each grid point is a space. Simple shapes (points, vertical and horizontal lines, rectangles, and squares) can be drawn on the grid by specifying their coordinates and dimensions and a character to use in drawing them. Rectangles and squares can be outline-only or filled (solid).

Mr. Surd's program allows its user to draw a picture on such a grid and display it on demand (i.e., the picture is only displayed when the user requests it). The program repeatedly prompts the user to enter one of a selection of one-letter commands -- one for each allowed shape (point, vertical line, etc.), plus commands to display the drawing, clear the drawing, and quit. If the user enters the command to draw an object, the program prompts for its coordinates and dimensions and the character to use in drawing it.


next up previous
Next: Top-down design Up: CS1320 Homework 6 Previous: Problem description

1999-10-19