Question: Q: Help in solving this example on MIPS language (Digital Design and Computer Architecture) with solution to better understand, thanks. The hourly data and wage

Q: Help in solving this example on MIPS language (Digital Design and Computer Architecture) with solution to better understand, thanks. The hourly data and wage data is located at the bottom to merge together with this problem.

Problem1: How to write a program which can process the wages of 5 different employees of a company and as the final step, output summary information. Your program must have two arrays named identifiersand wages,each of size 5 - one to store employee identifiers, and the other to store employee wages. The array locations correspond in the sense that the employee identifier stored at location 0 of the identifiersarray, has the total wage for that same employee stored in location 0 of the wages array, and so on for the other locations.

Contains wages information which can be used for this Problem.

# Problem 1. An employer needs software that will calculate a single week's wage for an employee. # The week's wage is calculated as the regular wage plus the overtime wage. # If an employee works for 40 hours or less, then all those hours are considered regular time. # If the employee works more than 40 hours, the extra hours over 40 hours are considered as overtime. # The regular wage is regular times multiplied by the hourly wage rate, and the overtime wage is overtime multiplied with twice the hourly wage rate. # Your program must take two inputs, both of which can be assumed to be integers: total hours worked in the week, and hourly wage rate. # The output must be the total wage for the week as shown below in the samples. .data prompt: .asciiz "Enter hours worked in a week: " prompt2: .asciiz "Enter hourly wage rate in dollars: " prompt3: .asciiz " The total wage for the week is $"

.text li $v0,4 la $a0,prompt #it will print prompt syscall li $v0,5 syscall move $s0,$v0 #store worked hours

li $v0,4 la $a0,prompt2 #it will print prompt syscall li $v0,5 syscall move $s1,$v0 #store hour pay

li $t0,0 #store result bgt $s0,40,greaterThanLimit #data for the wage being greater than 40 mul $t0,$s0,$s1

j exit

greaterThanLimit: mul $t0,$s1,40 sub $s0,$s0,40 mul $s0,$s0,2 mul $s0,$s0,$s1 add $t0,$t0,$s0 exit:

li $v0,4 la $a0,prompt3 #it will print prompt syscall li $v0,1 move $a0,$t0 #store worked hours syscall

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!