Service

Chat Now

The purpose of this assignment is to give you practice using structs, using strings, writing...

The purpose of this assignment is to give you practice using structs, using strings, writing...

The purpose of this assignment is to give you practice using structs, using strings, writing functions and sorting. You will read a student file into an array of structs, determine grades, sort the array and print it out.


Program Steps and Requirements

  1. Use the Student struct shown below.
  2. Read the input file (partially shown below) and store the data in an array of structs. The input file contains 55 student records and one heading line.
  3. 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.
  4. Sort the array of student students in descending order by the total points.
  5. 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 codelab;
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

Stud Id Name Ex Ass 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);
}
 
manish jayant 06-Jul-2020

Answer (Solved)

question Get solution