Write a program in a script file. The program asks the user to enter the students’ grades in an array (one student per row). The program then calculates the course grades by using the function fgrade.

7 views (last 30 days)
Write a user-defined MATLAB function that calculates a student’s final grade
in a course using the scores from three midterm exams, a final exam, and six
homework assignments. The midterms are graded on a scale from 0 to 100
and each accounts for 15% of the course grade. The final exam is graded on a
scale from 0 to 100 and accounts for 40% of the course grade. The six homework
assignments are each graded on a scale from 0 to 10. The homework
assignment with the lowest grade is dropped, and the average of the remaining
assignments accounts for 15% of the course grade. In addition, the following
adjustment is made when the grade is calculated. If the average grade for the
three midterms is higher than the grade for the final exam, then the grade of
the final exam is not used and the average grade of the three midterms
accounts for 85% of the course grade. The program calculates a course grade
that is a number between 0 and 100.
For the function name and arguments use g = fgrade(R). The input
argument R is a matrix in which the elements in each row are the grades of
one student. The first six columns are the homework grades (numbers
between 0 and 10), the next three columns are the midterm grades (numbers
between 0 and 100), and the last column is the final exam grade (a number
between 0 and 100). The output from the function, g, is a column vector with
the student grades for the course. Each row has the course grade of the student
with the grades in the corresponding row of the matrix R.
The function can be used to calculate the grades of any number of students.
For one student the matrix R has one row.

Answers (0)

Categories

Find more on Financial Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!