Please help if you know it and don\'t copy the previous solutions because they d
ID: 3755706 • Letter: P
Question
Please help if you know it and don't copy the previous solutions because they don't work. I've already spent 2 of my questions
I would prefer a screenshots of the scripts than typed versions. thank you!
Write a script M-file hw04-4 . Ti that prompts for a user key-board input of a numeric grade and outputs the corresponding letter grade on the terminal. The script uses a user defined function M- file that is passed a numeric grade from 0 to 100 and returns a letter grade according to the scheme A (90-100), B (80 to less than 90), C (70 to less than 80), D ( 60 to less than 70), F(less than 60). Write codes for both M-files. You are allowed to use Matlab built-in functions input and disp INPUT SCREEN Enter a Numeric Grade78 OUTPUT SCREEN: Letter arade Corresponding to Numeric Grade 78 is : CExplanation / Answer
% get user input
score = input('Enter a numeric grade : ');
grade = '';
% if greade is A
if score >= 90 && score <= 100
grade = 'A';
% if greade is B
elseif score >= 80 && score < 90
grade = 'B';
% if greade is C
elseif score >= 70 && score < 80
grade = 'C';
% if greade is D
elseif score >= 60 && score < 70
grade = 'D';
% if greade is F
elseif score < 60
grade = 'F';
% if score eneterd is invalid
else
grade = 'Invalid Score';
end
fprintf('Letter Grade Corresponding to Numberic Grade %f is : %s ', score , grade);
Sample Output
Enter a numeric grade : 36
Letter Grade Corresponding to Numberic Grade 36.000000 is : F
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.