Question
clc; clear; % Student numbers: stu_nums = 20200001:20200102; %% Randomly generated marks: for i = 1:length(stu_nums) stu(i).exam1 = randi([0 100]) ; stu(i).exam2 = randi([0 100])
clc; clear;
% Student numbers:
stu_nums = 20200001:20200102;
%% Randomly generated marks:
for i = 1:length(stu_nums)
stu(i).exam1 = randi([0 100]) ;
stu(i).exam2 = randi([0 100]) ;
stu(i).lab = randi([0 100]) ;
stu(i).fin_exm = randi([0 100]) ;
stu(i).fin_grd = round(stu(i).exam1*0.25 + stu(i).exam2*0.2 + stu(i).lab*0.15 + stu(i).fin_exm*0.4) ;
end
%% Finding non-failing students:
S = 0 ;
for i = 1:length(stu_nums)
if stu(i).fin_exm < 35 || stu(i).lab < 10
stu(i).let_grd = 'FF' ;
else
S = [S stu(i).fin_grd] ;
end
end
%% Mean of non-failing students' marks and standard deviation:
S(1) = [] ;
avg = mean(S) ;
st_dev = std(S) ;
%% Grade range:
CC = avg ;
% Starting points for upper grades:
CB = round(CC+st_dev/2) ;
BB = round(CB+st_dev/2) ;
BA = round(BB+st_dev/2) ;
AA = round(BA+st_dev/2) ;
% Ending points for lower grades:
DC = round(CC-st_dev/2) ;
DD = round(DC-st_dev/2) ;
FD = round(DD-st_dev/2) ;
FF = round(FD-st_dev/2) ;
%% Grade each student:
for i = 1:length(stu_nums)
if stu(i).fin_grd <= FF
stu(i).let_grd = 'FF' ;
elseif stu(i).fin_grd > FF && stu(i).fin_grd <= FD
stu(i).let_grd = 'FD' ;
elseif stu(i).fin_grd > FD && stu(i).fin_grd <= DD
stu(i).let_grd = 'DD' ;
elseif stu(i).fin_grd > DD && stu(i).fin_grd <= DC
stu(i).let_grd = 'DC' ;
elseif stu(i).fin_grd > DC && stu(i).fin_grd < CB
stu(i).let_grd = 'CC' ;
elseif stu(i).fin_grd >= CB && stu(i).fin_grd < BB
stu(i).let_grd = 'CB' ;
elseif stu(i).fin_grd >= BB && stu(i).fin_grd < BA
stu(i).let_grd = 'BB' ;
elseif stu(i).fin_grd >= BA && stu(i).fin_grd < AA
stu(i).let_grd = 'BA' ;
elseif stu(i).fin_grd >= AA
stu(i).let_grd = 'AA' ;
end
end
Develop a computer program which would read these data and calculate the total grade for each student. The weight of the each item for final grade calculation is; examm 1 25 %, examm 2 20%, lab 15% and final examm 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 examm 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.
6. After the letter grades are calculated the program would ask the user what type of information is asked for. The program should ask the user whether the user wants to see overall grade distribution or grade information for an individual. Here your program should watch for invalid input. If the user enters an invalid input, the program should warn the user and ask for the input again until the user enters a valid input. In this phase the program should NOT stop until the user enters a valid input.
7. If the user selects to see overall grade distribution your program should write in a text file; the number of people who received AA, the number of people who received BA, etc for all grades. The program should also write the number of people who passed and the number of people who failed into the text file. You should design the format of the output such that it should be neatly written and explanatory. Your program should also produce three figures. 1) A pie chart for letter grade distribution, 2) a histogram of letter grades, 3) a bar chart for total grades of each student long with a horizontal line showing the mean of the class calculated in step 3 above. The name of the text file should be class_info with the extension of txt or dat
I found first 5 steps but couldn't solve how to solve 6 and 7. can you help me? thanks in advance
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started