Question
Create a MIPS program that does the following:

4. Determine the letter grade a. Use the floating point calculated average to determine the letter grade. You will need to re
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Screenshot

GradeCalculator.asm #Program to calculate average and grade of a student #Get grades from user #Calculate average and display

Program

########################################################################################################
#Program to calculate average and grade of a student
#Get grades from user
#Calculate average and display
#Then find grade and displayu
########################################################################################################
.data
   prompt1: .asciiz "How many grades: "
   prompt2:.asciiz "Enter grade: "
   output1: .asciiz "Average is: "
   output2: .asciiz "\nYour letter grade is: "
.text
   #Prompt for grades count
   li $v0,4
   la $a0,prompt1
   syscall
   #Read user enter count
   li $v0,5
   syscall
   #Store count in s0
   move $s0,$v0
   #Variable for sum
   mtc1 $zero, $f12
   #Variable for looping
   li $t0,0
#Loop to get each score
#Find their total in f12
Loop:
   beq $t0,$s0,next
   #Prompt for grade
   li $v0,4
   la $a0,prompt2
   syscall
   #read grade
   li $v0,6
   syscall
   #Calculate totals
   add.s $f12,$f12,$f0
   addi $t0,$t0,1
   j Loop
#Display outputs
next:
   #Convert count of grades into float for average calculation
   mtc1 $s0, $f2
   cvt.s.w $f2, $f2
   #Calculate average and store in f12
   div.s $f12,$f12,$f2
   #Display average message
   li $v0,4
   la $a0,output1
   syscall
   #Display average
   li $v0,2
   syscall
   #Display grade message
   li $v0,4
   la $a0,output2
   syscall
   #compare if the average less than 100
   li $t1,100
   mtc1 $t1, $f2
   cvt.s.w $f2, $f2
   c.le.s $f12,$f2
   #Compare less than 9
   li $t1,90
   mtc1 $t1, $f2
   cvt.s.w $f2, $f2
   c.lt.s $f12,$f2
   #If greater than or equal 90 goto printA
   bc1f printA
   #Check less than 80
   li $t1,80
   mtc1 $t1, $f2
   cvt.s.w $f2, $f2
   c.lt.s $f12,$f2
    #If greater than or equal 80 goto printB
   bc1f printB
   #Check less than 70
   li $t1,70
   mtc1 $t1, $f2
   cvt.s.w $f2, $f2
   c.lt.s $f12,$f2
    #If greater than or equal 70 goto printC
   bc1f printC
   #Check less than 60
   li $t1,60
   mtc1 $t1, $f2
   cvt.s.w $f2, $f2
   c.lt.s $f12,$f2
   #If greater than or equal 60 goto printD
   bc1f printD
#Otherwise print F
   li $a0,70
   li $v0,11
   syscall
#End of the program
End:
   li $v0,10
   syscall
#Print A label
printA:
   li $a0,65
   li $v0,11
   syscall
   j End
#Print B label
printB:
   li $a0,66
   li $v0,11
   syscall
   j End
#Print C label
printC:
   li $a0,67
   li $v0,11
   syscall
   j End
#Print D label
printD:
   li $a0,68
   li $v0,11
   syscall
   j End

--------------------------------------------

Output

How many grades: 2
Enter grade: 59
Enter grade: 63
Average is: 61.0
Your letter grade is: D
-- program is finished running --

----------------------------------------------------

Note:

I am using MARS4.5 as editor

Add a comment
Know the answer?
Add Answer to:
Create a MIPS program that does the following: 4. Determine the letter grade a. Use the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. Create a program that takes a numerical score and outputs a letter grade. 2. In...

    1. Create a program that takes a numerical score and outputs a letter grade. 2. In this program, create two void functions titled makeScore and theGrade with an int argument. 3. The function makeScore should have a Reference parameter and theGrade should have a Value parameter. Note: Specific numerical scores and letter grades are listed below: 90-100 = Grade A 80-89 = Grade B 70-79 = Grade C 60-69 = Grade D 0-59 = Grade F 4. The function makeScore...

  • Write a C++ program that will provide a user with a grade range if they enter...

    Write a C++ program that will provide a user with a grade range if they enter a letter grade. Your program should contain one function. Your function will accept one argument of type char and will not return anything (the return type will be void), but rather print statements to the console. Your main function will contain code to prompt the user to enter a letter grade. It will pass the letter grade entered by the user to your function....

  • First, create two inputs that can be stored in variables consisting of a student's name. When...

    First, create two inputs that can be stored in variables consisting of a student's name. When the program begins ask "Who is the first student?" followed by "Who is the second student?" You only have to have two students for this program. Ask the user for the scores for the last three test grades for each of the students .   After the user has entered both names, and three scores for each, the program should display the following as output:...

  • [Using Python] Use the grade scale in the syllabus for this class, write a program that...

    [Using Python] Use the grade scale in the syllabus for this class, write a program that inputs a score, and prints the grade for that score. For example, if I input 90.0, your program should print A. Grading Scale is: 100% - 90% A 89% - 80% B 79% - 70% C 69% - 60% D 59% - 0% E

  • Design a function named max that accepts two integer values as arguments and returns the value...

    Design a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. For example, if 7 and 12 are passed as arguments to the function, the function should return 12. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is the greater of the two. Need Variable lists, Psuedocode, ipo chart, Flow Chart, and a python...

  • Write a program that asks the user to enter five test scores. The program should display...

    Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Design the following functions in the program: calcAverage—This function should accept five test scores as arguments and return the average of the scores. determineGrade—This function should accept a test score as an argument and return a letter grade for the score (as a String), based on the following grading scale: Score Letter Grade...

  • Create a program using MIPS that does the following: The program will do the following: Prompt...

    Create a program using MIPS that does the following: The program will do the following: Prompt the user to enter a letter indicating Celsius or Fahrenheit C or c indicates that temperature entered is in Celsius. F or f indicates that temperature entered is in Fahrenheit. If the letter entered is not C, c, F, or f, print out error message "Wrong Letter!". Prompt the user to enter an integer indicating the temperature matching the letter just entered. Convert the...

  • DO NOT USE ARRAYS IF YOU KNOW ABOUT ARRAYS, I WANT YOU TO USE 3 VARIABLES,...

    DO NOT USE ARRAYS IF YOU KNOW ABOUT ARRAYS, I WANT YOU TO USE 3 VARIABLES, IT WILL FORCE YOU TO USE COMPOUND LOGICAL STATEMENTS FOR THE IF STATEMENTS. Create a program that will display a menu to the user. The choices should be as follows: Enter 3 grades Show average (with the 3 grades) and letter grade Show highest grade Show lowest grade Exit If you want to put the menu into a function you may. The program should...

  • Test Scores and Grade Write a program that has variables to hold three test scores. The...

    Test Scores and Grade Write a program that has variables to hold three test scores. The program should ask the user to enter three test scores and then assign the values entered to the variables. The program should display the average of the test scores and the letter grade that is assigned for the test score average. Use the grading scheme in the following table: Test Score Average Letter Grade 90–100 A 80–89 B 70–79 C 60–69 D Below 60...

  • Solve This Problem using python and please comment on every line. also, use function to solve...

    Solve This Problem using python and please comment on every line. also, use function to solve this. thanks The result will be like as below: Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following functions in the program: This function should accept five test scores as arguments and return the average of the scores. This function should accept a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT