Write a program that assigns letter grades Solution


Problem: Write a program that assigns letter grades for a class automatically based on numerical scores. A score is a number in the range of 0.0 – 100.0 and may have decimal digits, e.g. 89.67, 76 etc. The grading scale is as follows:
Numerical score Letter grade
90.0 or above A
80.0 or above but below 90.0 B
70.0 or above but below 80.0 C
60.0 or above but below 70.0 D
Below 60.0 F
A list of students’ names and their numerical scores are recorded in a text file named Scores.txt. The program should read the names and scores from the file and display a table where each row shows: student name, numerical score, and letter grade. After the table, it should display the following statistics: number of students in the class, the average score, and the number of students for each grade.
Notes on Program Design:
• Though not necessary for this problem, as a practice, you’re required to use three arrays that are parallel: one for students’ names, one for scores, and one for grades. Assuming that a class has a capacity of 30 students, the arrays should be declared with a size of 30.
• Though not necessary for this problem, either, as a practice, you’re required to have at least one function in your program. What the function does is up to you. It could be a function that determines the letter grade based on the numerical grade or, it could be a function that outputs the result.
• The record for each student is given in Scores.txt. Please read each record into the aforementioned three arrays. To help you with that, the pseudocode is given at the very end of this document. You should incorporate it into your pseudocode. Scores.txt is also attached in this topic.
• The index of an array should start from 0 in your pseudocode, but should start from 1 in your Raptor program. As you know, declaring variables and arrays is not necessary in Raptor, but please declare all variables and arrays in your pseudocode.
Powered by