Summary: Write a program that determines letter grades for students in a class, using your understanding of control flow, arrays (and/or pointers, structures), disk files, and error conditions in C.
Description: Your program accepts two command line arguments. The first argument is the name of a disk file that contains the names of students, and their test scores, separated by commas followed by one or more spaces. Each line in the file will contain scores for one student. The second argument to your program is the name of an output disk file. Your program creates a new output disk file using that name. You will write grade information of all students whose information was read from input file, in a sorted order into this output file. You will be writing one line in the output file for one student. You will write name of one student and the letter grade he/she got in the class in each line (you should format the texts in the output file). The format of the data in the input file is fixed, however the number of students in the input file is unknown during compile time. The name of input and output files could be anything and only known during run time. Besides writing to the output file, you will also need to display the averages of scores along with minimum and maximum scores for each test in the screen/console.
Calculation: The test scores are weighed. There are four quizzes, 40% total, midterm I is 20%, midterm II is 15% and the final is 25%. All scores in the input file are recorded out of 100. You need to apply the weight for each score in the program to calculate the final score. The final score is tabulated as follows:
Final Score= quiz1 * .10 + quiz2 * .10 + quiz3 * .10 + quiz4 * .10 +midi* .20 + midii * .15 +final* .25
Determination of letter grade is according to the following logic:
Final Score>= 90% then letter grade is A, 80%-89% B, 70%-79% C, 60-69% D, <= 59% F
Sample input data file: input_data.txt (the input data format is: name, quiz1, quiz2, quiz3, quiz4, midi, mid ii, final -Assume that data will be correctly formatted as described.), e.g.:
Thui Bhu, 100, 90, 80, 100, 89, 99, 88
Ariana B. Smith, 90, 90, 100, 100, 99, 100, 95
Emily Ganz ales, 100, 90, 100, 70, 78, 78, 80
Jennifer L, 80, 90, 90, 100, 89, 99, 85
Maria Jones, 65, 72, 77, 68, 62, 70, 65
Bill Gates, 60, 54, 38, 62, 65, 60, 50
Escobar Morris, 83, 77, 88, 76, 79, 72, 76
Anne Latner, 80, 80, 85, 95, 90, 95, 90
..
<< more if there are more students >>
Sample output file: output_data.txt (the output format is: Name: letter grade, sorted by full name (first name+middle initial+last name), e.g.
Letter grade for 8 students given in input_data.txtfile is:
Anne Latner: B
Ariana B. Smith: A
Bill Gates: F
Emily Gonzales: B
Escobar Morris: C
Jennifer L: B
Maria Jones: D
Thui Bhu: A
<< more if there are more students >>
Sample Run of the program (name of your program is Lettergrader): Remember that there are two sets of outputs. Letter grade is written into the output disk file (which is not shown on the screen), only score averages are displayed on the screen (and are not written into the disk file).
Example Run 1: see image.
Sample Run 2 (it will have different set of data and so will be the output): see image.
Note:
1) You will be able to run this application with your choice of IDE as well, including Visual Studio by providing command line arguments in the settings. All IDEs allow you to enter the command line arguments.
2) The disk output for different input file will be different, however, the format of the output should be similar as shown in the example above (output_data.txt)
Design Hint: You are free to use your own design however; here is a guide to make it modular design:
You can write your application spread out in multiple .c and .h files (remember that there is only one main in any application, even if you have multiple .c and .h files for that application).