subject

In this assignment you'll write a program that calculates the checksum for the text in a file. Your program will take two command line parameters. The first parameter will be for the size of the checksum (8, 16, or 32 bits). The second parameter will be the name of the input file for calculating the checksum. The program must generate output to the console (terminal) screen as specified below. Command Line Parameters
1. Your program must compile and run from the command line.
2. The program executable must be named "checksum" (all lower case, no spaces or file extension).
3. Input the required file names as command line parameters. Your program may NOT prompt the user to enter the file names. The first parameter must be the size, in bits, of the checksum. The second parameter must be the name of the file used for calculating the checksum, as described below. The sample run command near the end of this document contains an example of how the parameters will be entered.
4. Your program should open the two files, echo the processed input to the screen, make the necessary calculations, and then
Checksum size
The checksum size is a single integer, passed as the first command line argument. The valid values are the size of the checksum which can be either 8, 16, or 32 bits. Therefore, if the first parameter is not one of the valid values, the program should advise the user that the value is incorrect with a message formatted as shown below
The number X is not a valid checksum size: valid checksum sizes are 8, 16, or 32.
The message should be sent to STDERR. (Note that the number X shown above should be the invalid
Format of the input file
The input file will consist of the valid ASCII characters associated with the average text file. This includes punctuation numbers, special characters and whitespace.
Output Format
The program must output the following to the console (terminal) screen:
1. Echo the input file
2. Print the checksum. The echoed input text should be in rows of exactly 80 letters per row, except for the last row, which may possibly have fewer. These characters should correspond to the input text.
The checksum line should be formatted as follows Where X is the checksum size of 8, 16, or 32 and the filename xyz. ext is the input filename and Z is the calculated sum.
Your program must read in an input text file that may contain uppercase letters, lowercase letters and non-letter characters. Your program should then calculate the checksum appropriately for the size specified in the command line. Specifically, if the checksum is 8 bits long, each character should be used as the number to be added to the checksum. Likewise, if the checksum is 16 bits long, each two characters should be added to the checksum. Note that there is a 50% chance that there will be one character short on the input file. In that case use the character "X" (an uppercase X) as the pad character. Similarly, if the checksum is 32 bits, use the same technique and character to pad the input string appropriately

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:10
In mathematics and computer science, a set is a collection in which order does not matter and there are no duplicates. in this problem, we are going to to define a class which wil allow us to create an object to represent a set of integers. you will write a program set.java to define the class set. each instance of the class set will be an object representing a set of integers.
Answers: 3
question
Computers and Technology, 21.06.2019 22:00
Which one of the following would administrators use to connect to a remote server securely for administration? a. telnetb. secure file transfer protocol (sftp)c. secure copy (scp)d. secure shell (ssh)
Answers: 1
question
Computers and Technology, 22.06.2019 10:00
Which of the following is true of operations within a spreadsheet program’s built-in functions? a. operations within parentheses, then multiplication and division, and then addition and subtraction are computed. b. operations within parentheses, then addition and subtraction, and then multiplication and division are computed. c. multiplication and division, then addition and subtraction, and then operations within parentheses are computed. d. addition and subtraction, then multiplication and division, and then operations within parentheses are computed
Answers: 2
question
Computers and Technology, 22.06.2019 22:20
Avariable of the data type arrays is storing 10 quantities. what is true about these quantities? a. the quantities all have different characteristics. b. the quantities all have the same characteristics. c. five quantities have the same and five have different characteristics. d. it is necessary for all quantities to be integers. e. it is necessary for all quantities to be characters.
Answers: 2
You know the right answer?
In this assignment you'll write a program that calculates the checksum for the text in a file. Your...
Questions
question
Mathematics, 25.11.2019 01:31