Question: Write a program which will get the name and grade from a student. You should then greet the person and display the letter grade they
Write a program which will get the name and grade from a student.
You should then greet the person and display the letter grade they have.
This assignment is to test your ability to use the condition statements logically.
example:
Please enter your name: Mark
Please enter your grade: 88
Mark, you got a B in the class
You are to submit the .asm file when you are done. If you used the .if statements found on google, you will get a zero. condition statements in this class use cmp. Example: cmp eax, 5 ;will compare eax to 5. After that it should be able to conditional jump. Example: jg greater1 ; jump if greater to the label greater1.
MASM Irvine32
TITLE MASM template
INCLUDE Irvine32.inc
; Program to get name and grade from a student .DATA nameuser DWORD, grades DWORD, msg1 BYTE "Please enter your name: ", 0 msg2 BYTE "Please enter your grade: ", 0 msg3 BYTE "You got an A in the class", 0 msg4 BYTE "You got a B in the class", 0 msg5 BYTE "You got a C in the class", 0 msg6 BYTE "You got a D in the class", 0 msg7 BYTE "You got an F in the class", 0
.code main PROC mov edx, OFFSET msg1 call WriteString call ReadString mov nameuser, eax mov edx, OFFSET msg2 call WriteString call ReadDec mov grades, eax
mov edx, name call WriteString cmp grade, 90 jg Agrade cmp grade, 80 jg Bgrade cmp grade, 70 jg Cgrade cmp grade, 60 jg Dgrade jmp Fgrade Agrade: mov edx, OFFSET msg3 call WriteString jmp done
Bgrade: mov edx, OFFSET msg4 call WriteString jmp done
Cgrade: mov edx, OFFSET msg5 call WriteString jmp done
Dgrade: mov edx, OFFSET msg6 call WriteString jmp done
Fgrade: mov edx, OFFSET msg7 call WriteString
done: call Crlf exit main ENDP END main 
1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
