Question

asembley language please Chapter 3 Arithmetic 1. Enter three test scores from the keyboard. Compute and...

asembley language please

Chapter 3 Arithmetic

1. Enter three test scores from the keyboard. Compute and display the average of the scores.
2. Display the product (just to do some multiplication) of the three scores.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Below is your MIPS assembly code :

.data   # data section

# defining string
enter_integer: .asciiz "Enter 3 test scores: "
average:       .asciiz "average: "
multiply:      .asciiz "\nmultiply: "

.text # text section
       
.globl main

main:
   # printing "enter_integer" to console
   la $a0, enter_integer
   li $v0, 4
   syscall

   # reading integer from user
   li $v0, 5
   syscall
   move $t1,$v0 # storing 1st test score to $t1

   # reading integer from user
   li $v0, 5
   syscall
   move $t2,$v0 # storing 1st test score to $t2   

   # reading integer from user
   li $v0, 5
   syscall
   move $t3,$v0 ## storing 1st test score to $t3

   # printing "average: " to console
   la $a0, average
   li $v0, 4
   syscall
   # adding all 3 test scores and saving them to $s1
   li $s1,0
   add $s1,$s1,$t1
   add $s1,$s1,$t2
   add $s1,$s1,$t3
   # loading $s0 with 3
   li $s0,3
   # calculating average and storing result to $s1
   divu $s1,$s1,$s0
   # printing average
   la $a0,($s1)
   li $v0,1
   syscall

   # printing "multiply: " to console
   la $a0, multiply
   li $v0, 4
   syscall
   # loading $s1 with 1
   li $s1,1
   # multiplying all test socres and saving them to $s1
   mulu $s1,$s1,$t1
   mulu $s1,$s1,$t2
   mulu $s1,$s1,$t3
   # printing multiplication of test scores
   la $a0,($s1)
   li $v0,1
   syscall

   done:
   # terminating program
   move $v0,$0
   add $v0,$v0,10
   syscall

Sample Output:

Add a comment
Know the answer?
Add Answer to:
asembley language please Chapter 3 Arithmetic 1. Enter three test scores from the keyboard. Compute and...
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
  • C language 2. Write a program to read in a string from the keyboard and only...

    C language 2. Write a program to read in a string from the keyboard and only display the vowels and their positions index) in a table format. Enter a string: This is a test Here are the vowels and their positions:

  • 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...

  • Write a program that prompts the user to input three different integers from the keyboard, then...

    Write a program that prompts the user to input three different integers from the keyboard, then prints the sum, the average, and the product. The screen dialogue should appear exactly as follows: Enter three different integers: 13 27 14 Sum is 54 Average is 18 Product is 4914 Please code in c program

  • If anyone can make this coded in C++ language. Thank You Lab2 (1) Protected View -...

    If anyone can make this coded in C++ language. Thank You Lab2 (1) Protected View - Saved to this PC w Design Layout ReferencesMailings Review View Help Tell me what you want to do ue: reo.2u Q1. Write a program that will read your initials and five test scores. Your program should then compute your test average and print all information in a reasonable form with suitable messages Note: use two character variables to read input from the user (storing...

  • CSC888 has 4 people. Each person needs to take 3 tests. Create a 4-by-3 two-dimensional array...

    CSC888 has 4 people. Each person needs to take 3 tests. Create a 4-by-3 two-dimensional array to store the test scores. Ask the user to enter test scores one at a time to populate this array. Once the whole array is filled, do the following two things. (1) For each student, display her test scores and the average of the three tests. (2) For each test, display student scores and the average of the four students. The following shows a...

  • 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...

  • IPPOOH. 34. The following table shows the test scores of seven students on three tests. Test...

    IPPOOH. 34. The following table shows the test scores of seven students on three tests. Test 1 Test 2 Test 3 Jones 90 | 75 60 Chan 70 Rocco 81 Johnson 72 Stein 63 Rio 87 69 Smith 50 77 | 83 View the columns in the body of the table as vectors ej, c2, and cz in R?, and view the rows in the body of the table as vectors ry, r2, ..., r, in R3. (a) Find scalars...

  • [JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and...

    [JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and methods must be used for this program. Process: •Read the number of students in a class. Make sure that the user enters 1 or more students. •Create an array with the number of students entered by the user. •Then, read the name and the test score for each student. •Calculate the best or highest score. •Then, Calculate letter grades based on the following criteria:...

  • 1. Please provide a C++ program which faithfully reads a list of non-negative integer scores, ultimately...

    1. Please provide a C++ program which faithfully reads a list of non-negative integer scores, ultimately terminating the list reading when the sentinel value (lets use -9999) is entered. The program should then correctly report the number of non-negative scores entered and the arithmetic mean (average) of those scores 2. Demonstrate your programs behavior in response to errors on input (that is, show that it faithfully rejects improper input such as alphabetic characters, decimal points, and commas). Here are some...

  • Write a program in C++ to: 1. Read up to 10 names and 10 test scores...

    Write a program in C++ to: 1. Read up to 10 names and 10 test scores from the keyboard (provide a method to end the input) (2 points); 2. print out the names and scores in a two column format (2 points); 3. use the function sort (you have to develop one) to sort the list according to test scores(4 points); 4. print out the sorted names and scores in a two column format (2 points)

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