Mac B.

asked • 05/17/20

read a student file into an array of structs, determine grades, sort the array and print it out.

Use the Student struct shown below.

Read the input file and store the data in an array of structs. The input file contains student records and one heading line.

Write code to determine the grade for each student. The grade determination is exactly as specified for this class in the syllabus. Remember to discard the lowest assignment grade.

Sort the array of student students in descending order by the total points.

Write the output file using the exact format shown below and include the two lines of headings in the output.


Required Student struct and named constants

const unsigned NumberOfStudents = 55;

const unsigned PointsPossible = 400;

const unsigned NumberOfAssignments = 10;

const unsigned NumberOfExercises = 10;


struct Student

{

   int id;

   string name;

   int exercise[NumberOfExercises];

   int assignment[NumberOfAssignments];

   int midterm;

   int final;

   int extra;

   int exerciseTotal;

   int assignmentTotal;

   int totalPoints;

   int percent;

   string grade;

};

Input file

-StudId- -------Name-------- -----Exercises----- ---------Assignments--------- Mi Fin CL

12345678 Smartiepants, Sam  5 4 5 4 5 5 5 5 5 5 20 19 20 20 20 20 19 20 20 19 65 98 9

18519268 Mendoza, Victor    4 2 5 4 1 4 5 5 5 4 17 12 17 18 14 17 19 18 14 18 59 49 6

23276929 Chien, Shengfeng   2 3 0 4 4 5 2 5 5 2 9 18 15 8 19 18 18 16 19 13 64 89 8

18242679 Dhaliwal, Shawn    5 5 3 4 5 4 2 4 4 5 9 18 17 15 18 19 12 15 18 14 45 92 9

09869966 Miraftab, Mina     5 3 5 5 3 5 4 0 4 3 17 4 3 18 12 16 14 17 17 12 52 68 7

10930997 Dimas, Abraham     5 3 4 5 4 3 4 3 3 3 12 18 20 11 14 7 15 10 18 15 64 89 6

11545560 Masongsong, Mikhael 1 3 5 4 3 4 5 3 5 5 19 19 9 13 17 20 20 14 14 19 64 96 8

10626377 Zigler, Joshua     4 3 4 3 2 5 4 4 4 5 17 14 18 20 17 18 12 19 14 14 51 90 5

Output report file should look like this

Stud Id Name               Ex Assign Mi Fin CL Tot Pct Gr

-------- ------------------- -- --- -- --- -- --- --- --

12345678 Smartiepants, Sam  48 178 65 98 9 398 100 A+

11545560 Masongsong, Mikhael 38 155 64 96 8 361 90 A-

20767544 Martins, Gustavo   40 144 67 97 10 358 90 A-

23305464 Zumwalt, Jacob     37 160 62 90 8 357 89 B+

23579439 Feirstein, Berent  42 159 55 91 9 356 89 B+

14965959 Ho, Brandon        40 157 66 84 8 355 89 B+

19988142 Wang, Lu           31 157 58 98 9 353 88 B+

09559062 Mora, Gabriel      36 137 67 100 7 347 87 B

19108176 Bailey, Tanequa    44 152 56 85 8 345 86 B

Suggested main function

int main()

{

   Student students[NumberOfStudents];

   getStudentDataFromFile(students, InputFilename);

   determineGrades(students);

   sort(students);

   printStudentDataToFile(students,OutputFilename);

}

grading policy:

Programming Assignments 180 points 20 each Lab Exercises 50 points 5 each Midtearm 70 points Final 100 points Extra Credit: Extra ~10 points prorated Total 400 points Points Percent Grade 360-400 90-100% A, 320-359 80-89% B, 280-319 70-79% C, 240-279 60-69% D, Below 240 Below 60% F,



1 Expert Answer

By:

Patrick B. answered • 05/18/20

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.