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, 22.06.2019 08:30
On the loan worksheet in cell c9 enter pmt function to calculate the monthly payment for the altamonte springs 2018 facilities loan. ensure that the function returns a positive value and set the reference to cells b5 and b6 as absolute references.
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
You have been supporting csm tech publishing's windows server 2016 server network for over a year. the office has two windows server 2016 servers running active directory and a number of other roles. management has informed you that a small sales office is opening in the same building three floors up. the sales manager wants to install a sales application on a server located in the sales office. this server will have limited physical security because there's no special room dedicated for it, which means it will be accessible to non-it personnel and visitors. you're considering installing windows server 2016 server core on the new server because accessing its console regularly probably won't be necessary, and this server will be managed from one of the other csm tech publishing servers. what are the benefits and drawbacks of using server core for this branch office? what are some things you should do to set up this server management environment?
Answers: 1
question
Computers and Technology, 23.06.2019 10:00
Hey i just logged on and one of the moderators deleted a bunch of my answers to questions, even though the answers were right and the people it doesn't make sense but if anyone wants to talk about anything just message me lol (this is super random lol)
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
The processing of data in a computer involves the interplay between its various hardware components.
Answers: 1
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, 07.10.2020 17:01
question
Mathematics, 07.10.2020 17:01
question
World Languages, 07.10.2020 17:01
question
Mathematics, 07.10.2020 17:01
question
English, 07.10.2020 17:01
Questions on the website: 13722362