Adjusting Grades (3)

  1. Although taking the square root and multiply by 10 is a simple formula, it does not encourage students to study hard. It seems that students who have low grades benefit from this formula significantly. For example, if Alice's grade is 36, her new grade will become 60 (incremented by 24). However, if Bob's grade is 81, his new grade will become 90 (incremented by only 9).
  2. In this exercise, we shall adjust grades in a more complex way (and more realistic).
  3. Suppose the grades of students are distributed between 0 and 100 (perhaps not a normal distribution, but that does not matter). If few students get grades higher than 60, but the instructor can see that most students have studies hard, actively participated in class, and spent lots of time in writing programs, he may decide to adjust the grades so that more students can pass.
  4. The instructor will choose a threshold T (which is usually less than 60). For students whose grades are less than T, they are flunked and their grades need not be adjusted.
  5. For students whose grades are greater than or equal to T, the grade g will be adjusted by the formula: new_g = (g - T) * (UB - 75) / (max - T) + 75, where max is the maximum grade among all students, and UB is the upper-bound specified by the instructor for the adjusted grades. If the instructor decides that the highest grade in this class can be 100, he may let UB be 100. However, if the whole class does not work hard, the instructor may decide that UB can only be 89.
  6. For example, if UB = 100 and Carol's grade is equal to max, her adjusted grade will be 100. If Danny's grade is equal to T, his adjusted grade will be 75.
  7. According to this rule, it is quite possible that two students whose original grades are close, but the adjusted grades differ significant. For example, Emily's grade is 40 and Fantine's grade is 41, while T is 41. The adjusted grade of Fantine becomes 75, but Emily's grade remains unchanged. Therefore, you should see the necessity that even although you did not behave well in previous examinations, you should always try your best and work hard until the last moment. Every effort may contribute to your grade, and a little difference may help you to get passed!
  8. Modify your previous exercise about adjusting grades with this new rule. The input/output file format is the same, but the user need to supply extra parameters about T and UB at run-time. (The maximum grade can be calculated from the input file, of course.)
  9. To help the instructor to decide the value of T and UB, your program can display the maximum and average grade of the input file.

Your program may run as follows:

Please type the filename of student grades -- grade.txt
The maximum grade is 96
The average grade is 41.6

What would be the threshold to pass? 45
What would be the upper-bound of adjusted grades? 100
Please type a new filename to store adjusted grades -- new_grade.txt