159k views
3 votes
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.

User Avy
by
8.7k points

1 Answer

3 votes

Final answer:

The assignment requires writing a program to calculate checksum for the text in a file using command line parameters.

Step-by-step explanation:

The correct answer is option Computers and Technology. In this assignment, you are asked to write a program that calculates the checksum for the text in a file.

The program should take two command line parameters: the size of the checksum (8, 16, or 32 bits), and the name of the input file for calculating the checksum. After opening the file, the program should echo the processed input to the console screen, make the necessary calculations for the checksum, and generate the output as specified.

The correct answer is that this is a question related to Computers and Technology, specifically in the field of programming. Such a program would be tasked with calculating a checksum for the contents of a file.

A checksum is a value used to verify the integrity of file contents or data. In this case, the program should accept two command-line arguments: the first for the checksum size (8, 16, or 32 bits) and the second for the file name.

The program should then read the contents of the file, calculate the checksum according to the specified bit size, and output the result to the console

User Michael Lawrie
by
7.8k points