Assignment 4

Write a program that calculates the semester grades of students. The program first reads the number of students, and then reads six quiz scores for each student. Each score is an integer, and ranges between 0 and 10. Assume that there are at most 10 students. The program outputs the semester grades of students and the serial number of the easiest quiz.

  • The semester grade of a student is the mean of his/her scores after removing the smallest score and the largest score.

  • The serial number of the quiz begins from 1. That is, the serial numbers are: 1, 2, 3, 4, 5, 6. The easiest quiz is the one that produces the largest sum of student scores.

    • If there are two quizzes of the same difficulty, then report the one with the smaller serial number.

Program Input

Enter the number of students: 3

Enter the scores for each student:

2 4 2 8 1 8

0 2 0 10 7 2

9 1 4 8 6 1

Program Output

Table of Semester Grades:

Stud1 Stud2 Stud3

Grades: 4.0 2.8 4.8

The number 4 quiz is the easiest one.

  • Details:

    • For student 1, the corresponding scores are 2, 4, 2, 8, 1, 8. After removing the smallest and the largest ones, we have four scores: 2, 2, 4, 8, and the mean of the four scores is 4.0.

    • The sum of scores for the six quizzles are 11, 7, 6, 26, 14, 11, respectively. The largest sum of scores is 26, and thus the number 4 quiz is the easiest one.

  • Your solution should be based on the code template .

  • Your program must conform the following requirements:

    • The outputs of your program should behave as in the above example.

    • You only need to add your code to the function definitions of computeSemesterGrades() and displayEasyQuiz()

      • Add your code according to the comments in the function definition.

    • Do not modify readStudentGrades() and displaySemesterGrades()

    • Do not modify main() unless you know what you are doing.

  • More input-output samples.

  • Hint:

    • You can use sort(array, array+6) to sort an array with size 6.