# Solution Library

# MATLAB Program that Determines the Course Grade for a Student

**Question**

A class teacher is preparing the final grades for the students. She is entering grades into a table which will include scores from 5 homeworks, 3 midterms and 1 final. Write a program that determines the course grade for a student. The scores will be adjusted based on some grading criteria and then a letter grade will be assigned for each student. Also you will calculate class averages for each assignment and exam. Load hw6p4.mat in your script which contains the following data.

The matrix hwScore contains the homework scores of the students. The first column contains the student number. Each subsequent column contains the scores of homework graded out of 10.

The midterm scores are available in a separate matrix midScore. The first column contains the student number. Each subsequent column contains the scores of midterms graded out of 50.

The final scores are available in a separate matrix finalScore. The first column contains the student number. The second column contains the scores of the final graded out of 50.

Part 1

Using array operations check if all the entries in hwScore and midScore are correct.

a) Check if all the entries are non-negative numbers. In case there is a mistake, replace the entry of the corresponding student with the average score of that student in that category. Display the updated matrices.

b) Check if all the entries are within the total score of that category. In case there is a mistake, replace the entry of the corresponding student with the average score of that student in that category. Display the updated matrices.

Using array operations

a) Include the updated midterm scores and final scores to the updated hwScore as additional columns on the right and make this a new matrix called allScores. Display allScores.

The resulting table or matrix should have 1 column for student number, 5 columns for homework, 3 columns for midterms and 1 column for final.

Using array operations

a) Check if the entries/scores for a student in all categories are 0. In such case remove the record of such student from allScores.

b) Calculate the maximum and minimum grade for each category in allScores and place the answer in an array T.

c) Calculate the mean, median and the standard deviation for the class for each category in allScores and place the answer in 3 additional rows at the bottom of T, respectively. Display T.

Part 2

Homework: For each student, the score of the lowest homework is not counted towards the final grade and the average of the 4 homework with the higher scores constitutes 25% of the course grade.

Midterms: If the average of the midterm scores is higher than the score on the final, the average of the 3 midterms is 35% of the course grade. If the final score is higher than the average of the midterms, then the lowest midterm score is not counted towards the final grade and the average of the 2 midterms with the higher scores is 35% of the course grade.

Final: The final is 40% of the course grade.

Using array operations

a) Calculate the adjusted homework score, midterm score, and final score of each student and place the answers in 3 additional columns on the right of allScores, respectively. Display allScores.

b) Calculate the cumulative sum of each student’s adjusted scores. Hence, this total is out of 40 (as .25*10+.35*50+.4*50=40). Place the total in an additional column on the right of allScores and assign the updated allScores to a new matrix called grades.

c) Calculate the percentage of the total as a numerical course grade (a number between 0 and 100) and place the answer in an additional column on the right of grades. Display grades.

d) Finally, assign a letter grade based on the numerical course grade according to the following key and place the answer in an array G. Display G.

A for Grade >= 90,

B for 80 >= Grade < 90,

C for 70 >= Grade < 80,

D for 60 >= Grade < 70, and

E for Grade < 60.

**Summary**

This question belongs to MATLAB software and discusses about application of MATLAB in mathematics to write a program that determines the course grade for a student.

**Answer is in MATLAB format**

Download Full Solution

## Comments

Rashathis is a very good website

maaniI have 50 questions for the same test your page is showing only 28

joeannehi can you please help or guide me to answer my assignments. thanks

joeannehi can anyone help or guide me to my assignments. thanks

MonikCristinaThis solution is perfect ...thanks

JaneteHello Allison,I love the 2nd image that you did! I also, had never heard of SumoPaint, is something that I will have to exolpre a bit! I understand completely the 52 (or so) youtube videos that you probably watched. Sometimes they have what you want, sometimes they don't! However, it is always satisfying when you are able to produce something that you have taught yourself. Great job!Debra 0 likes

SandeepPerfect bank of solution.

Oxanagreat !

Paul Brandon-Fritziusthanks for the quick response. the solution looks good. :)

tina Johnsonthnx for the answer. it was perfect. just the way i wanted it.

Giuseppeworks fine.