I\'m newer to computer science so I haven\'t learn it much yet. I didn\'t get th
ID: 3793132 • Letter: I
Question
I'm newer to computer science so I haven't learn it much yet. I didn't get this project so please someone help me out.
Below is the information. Thank you so mcuh.
=============================================================
Arrays: Tiling with ASCII Art
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 prints 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.
Have a look at a sample run of the program.
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.
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 prints a copy of the image.
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.
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.
Arrays: Tiling with ASCII Art
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 prints 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.
Have a look at a sample run of the program.
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.
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 prints a copy of the image.
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.
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.
==========================================
The code should look like below.
==========================================
Sample output of the program.
Explanation / Answer
import java.util.*; import java.io.*; public class TileMap { private static String fileName = null; private static int imageHeight =0; private static int imageWidth=0; private static char[][] buffer = null ; /* FUNCTION NAME: Main ; INPUT: none. OUTPUT: a message to the user of this program, all of the prompts and a final display according to user specifications. PRECONDITIONS: None. POSTCONDITIONS: Variables and calls made according to users input output set to start on a new line. CALLERS: None. CALLES: askPermission, getParameters(), getImage(), and doTileJob(). */ public static void main(String args[]) throws FileNotFoundException { } /* FUNCTION NAME: askPermission ; INPUT: none. OUTPUT: a message to the user of this program. PRECONDITIONS: output set to start on a new line. POSTCONDITIONS: variable response has user's answer stored in it. CALLERS: the main program CALLES: None. */ public static boolean askPermission() { } /* FUNCTION NAME getParameters ; INPUT: the file name, number of tiles across and down. OUTPUT: message "Getting Image". PRECONDITIONS: the variable response has 'y' in it. POSTCONDITIONS: variables set with the values entered by user. CALLERS: the main program CALLEES: none */ static void getParameters() { } /* FUNCTION NAME: getImage ; INPUT:the file name and the height and width of the pattern to be made. OUTPUT: the message "Getting Image". PRECONDITIONS: array for image declared, the variables fileName, imageHeight and imageWidth set with proper values. POSTCONDITIONS: the image is stored in the array. CALLERS: the main program CALLEES: none */ public static void getImage() throws FileNotFoundException { } /* FUNCTION NAME: printImage INPUT:the buffer with the image and the height and width of the pattern to be made OUTPUT: the patterns structured according to users input. PRECONDITIONS: All of the variables are set and pattern is stored in 'buffer'. POSTCONDITIONS: Output displayed according to users input. CALLERS: the main program CALLEES: none */ // This function uses for loops to display the images. The inner most for loop prints one line of the picture. public static void printImage() { } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.