PRELIMINARIES:

You need to learn about top down design and array indexing to do this assignment properly.

THE ASSIGNMENT

According to my specifications, you will write a program that tiles a rectangular area with a piece of ASCII art.

INPUT

Your program will have two main sources of input. There will be keyboard input from the user of the program and input from files.

User input:

As illustrated by the sample run, the user tells the program whether to continue by entering 'y' or 'n'. When the user wishes to continue, s/he must enter the name of a specially formatted ascii image file. Also s/he must enter the dimensions of the desired tiling (number of tiles across, and number of tiles down).

It is very important to me that your program do exactly the same inputs as shown in the sample, in exactly the same order. Also your program must not input anything "extra."

I will test the programs in an automated fashion with a script that contains prepared answers to the prompts. I will be required to do extra work to test your program if your program does not conform to the input rules. In that case, you will lose significant credit.

File input:

The specially formatted ASCII image files look like this bee file and this bird file.

Each image file starts with a pair of numbers on the first line. These numbers tell the dimensions of the ASCII image in the file. The first number tells how many lines are in the image, and the second number tells how many characters are in each line of the image. (To make your programming job easier, the number of characters in each line of the image is the same. Lines that appear shorter are actually padded with blanks to make up the length.)

You will need to make some image files for testing your program. I think you can make a copy of each image in the assignment directory just by displaying the image file in your browser, selecting, pasting into an editor buffer, and saving as a file in a directory or folder.

OUTPUT:

The program must write all its output to standard output (the default standard output is the screen).

As the sample run of the program shows, the program must run in a cycle. First it writes a message asking the user if s/he wants to perform a tiling. If the user answers with the letter y, the program prompts for and gets the parameters from the user and then does the tiling by writing copies of the image across and down.

After doing the tiling the program goes back to the beginning of the cycle. When the user answers with the letter n instead of y, the program simply stops.

PROCESSING:

One reason I am assigning this program is to give you practice using a rectangular array.

Declare a global constant like this in your program:

public static int MAXSIDE = 100 ;

Also, declare a character buffer array like this in your main program:

char [] [] buffer = new char [MAXSIDE][MAXSIDE] ;

This gives your program a 100 X 100 array of characters to work with -- an array big enough to hold any of the images we will be using for input.

You are required to write the program so that when it performs a tiling, it first copies the image from the file into the "upper left corner" of the array (I'll explain more about that in class). Then the program must make the tiling by repeatedly copying portions of the array to the standard output in a certain controlled way (I'll talk more about that too.)

TESTING:

A programmer must be responsible for deciding what testing s/he needs to do on the 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 data coverage, you need to think of

  • cases of average input, and
  • cases of boundary input

and test those cases.

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

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.