Computer program for grade calculate

%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 (BY MATLAB) 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…

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

type or paste code 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
endhere

this is my computer program (matlab) which would read these data and calculate the total grade for each student.
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 my 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.
If the user selects to see overall grade distribution my 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. I should design the format of the output such that it should be neatly written and explanatory.
My 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.
how can ı do that?