(Latest Revision: 02/07/2001)

Arrays: Writing Block Letters


PRELIMINARIES:

You need to learn about top down design and array indexing to do this assignment properly. Do the reading in Carrano and come to lectures. You also need to read the directions and examples here: http://shalim.csustan.edu/~john/Classes/General_Info/progAsgRules/


THE ASSIGNMENT:

You will write a program that prints a phrase in large block letters.


INPUT:

This program has two main sources of input. There will be input from the user of the program and input from files.

file input:

Your program will use a database of twenty-six files containing images of "great big letters". Students made the files in a previous class of mine. Each file contains exactly 24 lines. Each line is exactly 75 characters long.

You will need to get a copy of each of the letter-files. In class, I will show how to get them all very quickly using unix and anonymous ftp. If you want to look at some of them, you can use this URL: (ftp://www.cs.csustan.edu/pub/john/Alpha).

user input:

In response to prompts from the program, the user will enter either the letter y or the letter n -- meaning yes or no.


OUTPUT:

The program will write all its output to standard output (the screen).

The program prints a message asking the user if s/he wants to see a certain phrase. If the user answers with the letter y, the program writes the phrase to the screen and prints the question again. This continues in a cycle as long as the user answers with the letter y. When the user answers with the letter n, the program simply stops.


PROCESSING:

You must choose the word or phrase your program prints. It must be at least 7 letters long.

When the program runs, and before it reads any input from the user or prints any output to the screen, it will copy each letter needed for the phrase from its letter-file into an array of char's with 24 rows and 75 columns. (I am requiring you to write the program this way to give you practice using arrays.)

For example, if my phrase is my name, JOHN SARRAILLE, then my program has to copy (at least) the letter files J, O, H, N, S, A, R, I, L & E into 24-by-75 arrays of char's.

When the program prints out the phrase, it has to do it by copying out the char's from each array.

In the case of my phrase, the program would first have to print out the array that contains the J, then the O, then the H, and so on until it prints all the letters.

The program will print letters "going down the page." When the program writes out one of the char arrays, it will write the first row going across a line, then it will print the second row going across the next line, and so on until it has written all 24 rows of the array.


EXAMPLE PROGRAM RUNS:

You may follow these links to see sample runs of successive levels of my solution to this programming problem:
DATA STRUCTURES AND DESIGN CONSIDERATIONS:

I am requiring that your program copy each block letter into a 24X75 array of char's. Good programminng practice demands that you make this kind of array a named data type in your program.

Depending on how you design your program it may be helpful to represent the entire set of 26 letters as an array of 26 24X75 arrays of char.

Your phrase should be appropriately represented. Perhaps it will be helpful to use a simple C++ string class for this purpose. Perhaps you will want to make your phrase an array of letters like the "alphabet" array described above.

You can see discussion of some more of these types of ideas in the document entitled designConsiderations.

We will also discuss these things in class.


TESTING:

You are responsible for deciding what testing you need to do on your program in order to verify it is correct. Testing can count for fifteen percent or more of your grade. The script of your tests must demonstrate adequate data coverage and code coverage. For adequate code coverage, you need to think of and test those cases.

For adequate code coverage you need to make sure that all the statements in your program execute during the testing.

We can discuss more about testing strategy in class.


WHAT TO TURN IN:

You will be sending me four e-mail messages. Please follow these rules: Here is the list of things you have to turn in:
  1. Send the following items to me by e-mail before midnight on the first due date:

    A level two version of the source code, with subject line: CS2500,prog1.2.

    and a script showing your test runs, with subject line: CS2500,scrp1.2.

  2. Send the following items to me by e-mail before midnight on the second due date:

    A final version of the source code, with subject line: CS2500,prog1.f.

    and a script showing your test runs, with subject line: CS2500,scrp1.f.

Note that there are no spaces in the subject lines given. It is important that you do not insert any spaces. My e-mail address is: john@ishi.csustan.edu.


DUE DATES:

For the due dates, see the class schedule.