Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is a MATLAB problem. Please use if-elseif statement. 22. Write a MATLAB pro

ID: 3721193 • Letter: T

Question

This is a MATLAB problem. Please use if-elseif statement.

22. Write a MATLAB program that will allow the student to select the grade earned in a course from a menu (with the options of earning an A, B, C,D, or F) that will display the numerical range for the selected grade. The output of the program displayed on the screen should be formatted as shown in the sample output. In your program, you must use standard 10-point grading scale if-elseif statement. Use the shown in the previous problem. Select the grade earned: Sample Input/Output f user selected A: If you earn the letter grade A, your numeric grade is in the range: 90grade

Explanation / Answer

function myButtonGUI

fig = uifigure;

btn_group = uibuttongroup('Visible','off',...

'Position',[0 0 .2 1],...

'Title','Select the grade earned',...

'SelectionChangedFcn',@handleGrade);

  

% Creating buttons

b1 = uicontrol(btn_group,'Style',...

'pushbutton',...

'String','A',...

'Position',[10 350 100 30],...

'HandleVisibility','off');

  

b2 = uicontrol(btn_group,'Style','pushbutton',...

'String','B',...

'Position',[10 250 100 30],...

'HandleVisibility','off');

b3 = uicontrol(btn_group,'Style','pushbutton',...

'String','C',...

'Position',[10 150 100 30],...

'HandleVisibility','off');

b4 = uicontrol(btn_group,'Style','pushbutton',...

'String','D',...

'Position',[10 150 100 30],...

'HandleVisibility','off');

b5 = uicontrol(btn_group,'Style','pushbutton',...

'String','F',...

'Position',[10 150 100 30],...

'HandleVisibility','off');   

  

% making GUI button visible

btn_group.Visible = 'on';

function handleGrade(source,event)

if(event.NewValue.String == 'A')

display('If you earn the letter grade A, your numeric grade is in the range: >90 and 100 <= grade');

elseif(event.NewValue.String == 'B')

display('If you earn the letter grade B, your numeric grade is in the range: 90 <= grade');

elseif(event.NewValue.String == 'C')

display('If you earn the letter grade C, your numeric grade is in the range: 80 <= grade');

elseif(event.NewValue.String == 'D')

display('If you earn the letter grade B, your numeric grade is in the range: 70 <= grade');

else

display('If you earn the letter grade B, your numeric grade is in the range: 60 <= grade');

end

end

end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote