calculate a grade of students
35 次查看(过去 30 天)
显示 更早的评论
%purpose is showing grades of 102 students and assign a letter grades
%the grades will be random numbers between 0 to 100
clc;clear;
student_numbers=20200001:20200102;
exam1=input('enter a value:');
exam2=input('enter a value:');
lab=input('enter a value:');
final_exam=input('enter a value:');
if final_exam>0 && final_exam<35
fprintf('your grade is FF');
elseif lab>0 && lab<10
fprintf('your grade is FF');
I want to develop a computer program which would calculate the total grade for each student. The weight of the each item for final grade calculation is; exam 1 25 %, exam 2 20%, lab 15% and final exam 40%. The final grades should be rounded to integers. After this, your program should specify the letter grade for each student. The rules for letter grade distribution are as follows:
1. Anybody whose final exam grade is less than 35 will automatically receive FF.
2. Anybody whose lab grade less than 10 will also automatically receive FF.
3. For the rest of the class excluding the people who failed at the first two steps, you would calculate the arithmetic average (mean) and standard deviation of the grades.
4. You will set CC grade to the mean grade you calculated in the previous step. Then you would add half the standard deviation to mean to set the starting point for the CB grade. Adding half the standard deviation once more would yield the starting point for the BB grade, etc… Following this procedure you would also calculate the starting points for the BA and AA grades.
5. For the grades lower than CC (DC, DD, FD and FF) you would successively subtract half of the standard deviation from the mean grade.
what should ı add up or change the code that ı write to make the program run. ı know its still on the first steps but ı get stuck and couldnt solve how to progress.. thank you in advance..
0 个评论
回答(1 个)
Steven Lord
2021-1-13
%purpose is showing grades of 102 students and assign a letter grades
%the grades will be random numbers between 0 to 100
clc;clear;
student_numbers=20200001:20200102;
% TODO: You're going to want to store these values in an array.
% You'll likely want to keep the people who failed the final or the lab as placeholders
exam1=input('enter a value:');
exam2=input('enter a value:');
lab=input('enter a value:');
final_exam=input('enter a value:');
if final_exam>0 && final_exam<35
% Step 1: Anybody whose final exam grade is less than 35 will automatically receive FF.
fprintf('your grade is FF');
elseif lab>0 && lab<10
% Step 2: Anybody whose lab grade less than 10 will also automatically receive FF.
fprintf('your grade is FF');
else
% Step 3: Calculate the arithmetic average (mean) and standard deviation of the grades.
% TODO: Fill in the array you created above.
end
% Step 4: Compute the bounds of each grade
% Step 5: For each student, determine their grade
If I interpret the question correctly, you're going to want to iterate through the 102 students and ask for their grades in turn. Steps 3, 4, and 5 sound like you'll need the data from all students to complete, so create an array to store the data. The NaN function may be of use in creating that array at the start of your code.
Do you know what functions exist in MATLAB to compute averages and standard deviation? If not, I recommend searching the documentation for some keywords (average and standard deviation seem like good first tries.) Open the documentation with:
doc
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!