Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

5.- Design an algorithm that will read a file of student letter grades and corre

ID: 3655515 • Letter: 5

Question

5.- Design an algorithm that will read a file of student letter grades and corresponding grade points and load them into two paired arrays, as follows: Letter grade Grade points A 12 B 9 C 6 D 3 F 0 Your program is to read each record on the file (which contains a letter grade followed by a grade point), validate the letter grade (which must be A,B,C,D,OF F), check that the grade point is numeric, and load the values into the parallel arrays. Your program is to stop processing when the files reaches EOF or the arrays are full. Print an error message if there are more records on the file than elements in the array. Without knowing what language you're in, I'll give some help. I mean, this just seems obvious so I may be stating the obvious here.

Explanation / Answer

Without knowing what language you're in, I'll give some help. I mean, this just seems obvious so I may be stating the obvious here. File.open "student_grade.csv" case when obj.str == true (check if the object is a string) do obj.str push array.new (put the string into an array) case when obj.int == true (check if the object is an integer) do obj.int push array.new (put the integer into an array) Then the index of both arrays will pair. (A = 0, 12 = 0; etc) Make sure to have some else statements in case the teacher fucks with you or the file has garbage. Have it do RaiseArgumentError after that, have it check the two arrays (stored in variables letter_grade, and grade_points) for validity for each |arg| in letter_grade do; if |arg| != A..F RaiseArgumentError ^checks every index of the array and if any of them aren't within the range of letters A..F, it gives an error. Just do the same for the grade_points array

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote