Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Assignment Grade Calculation: A certain class has no more than 100 students and has 6
- Assignments each worth 20 points throughout the semester. Write a program that will read the
- names and scores of the students from a file. The name of the first student will be on the first
- line and their 6 scores separated by spaces on the next line (the two files your program will be
- tested against are given on Blackboard). This will repeat for all students in the class. First ask
- the user for the file name and open it for reading. Be sure that it opens properly. For every
- student in the class read in the name of the student into an array and their scores on the 6
- Assignments into a 2D array. It is possible to earn half a point grades (for example 18.5), somake the type of the array for the scores appropriate. The index of the name and row of the
- grades should link the two arrays as parallel.
- After the scores are read in, display a table that includes the student names, their scores on the
- assignments and their average after dropping the lowest grade.
- • Hint: combine the min and sum algorithms. When looking for the min if it's updated add
- the old min to the sum before updating; otherwise, add the current element to the sum).
- • Hint: Use an array to hold each student's average score, since we will need them later to
- calculate their average.
- Also below every column, the following should be displayed (see sample output below):
- • average for each assignment,
- • Bonus (2pts): the standard deviation for each assignment
- ◦ The standard deviation can be found by modifying the following formula
- ▪ std deviation = sqrt ( sum ((score[i][j] – average_score[j]) ^ 2) / number of scores)
- ◦ Hint: Use an array to hold the average score on each assignment. Then for each
- column use nested loops to sum up all the scores in that column minus the average in
- the column squared. After the inner loop, divide that answer by the the number of
- scores and then finally take the square root.
- • the number of students who earned an “A” (a score greater than or equal to 18) on the
- assignment
- For full credit:
- • Use parallel arrays for the name and scores
- • Use a partially filled array for the names
- • Use a 2D array for the scores
- • Use constants for the max number of students (100) and the number of
- assignments (6)
- • Display all numbers to one decimal point
- • Follow standard naming procedure for your variables (camelCase or under_score
- for variables and ALL_CAPS for constants) and use appropriate types (e.g. you
- may read the phone number as a string). Give the variables descriptive names.
- • Use spaces and comments to separate and describe the logical parts of your
- program so that it is easy to read
- • Indent code inside blocks, including the main function and any if, switch statements, or
- loops
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement