Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider this program int width, length, depth; main(){ int area, volume, mulch; input Enter width in feet: , width; input Enter length in feet: ,

Consider this program

int width, length, depth; main(){ int area, volume, mulch; input "Enter width in feet: ", width; input "Enter length in feet: ", length; input "Enter depth in inches: ", depth; area = width * length; volume = ( area * depth + 11 ) / 12; mulch = (volume + 26) / 27; print " You need to cover ", area, " square feet "; print "You need ", mulch, " cubic yards of mulch "; exit; }

Implement the program in MIPS assembly language. Use the following partial program as the foundation for your program. You can cut-and-paste this code to a file.

Program pr1.s

.data getWidth: .asciiz "Enter width of area to mulch in feet: " getLength: .asciiz "Enter length of area to mulch in feet: " getDepth: .asciiz "Enter depth of of mulch in inches: " outMsg1: .asciiz " You need to cover " outMsg2: .asciiz " square feet " outMsg3: .asciiz "You need " outMsg4: .asciiz " cubic yards of mulch " .align 2 width: .word 0 length: .word 0 depth: .word 0 .text .globl main #register map for main # # $s0 area # $s1 mulch # # $t0 temporary for loading values main: # input data with prompts # input "Enter width in feet: ", width la $a0, getWidth li $v0, 4 syscall li $v0, 5 syscall sw $v0, width # input "Enter length in feet: ", length la $a0, getLength li $v0, 4 syscall li $v0, 5 syscall sw $v0, length # input "Enter depth in inches: ", depth la $a0, getDepth li $v0, 4 syscall li $v0, 5 syscall sw $v0, depth # compute area = width * length #compute volume = (area * depth + 11) / 12 #compute mulch = (volume + 26) / 27 #this rounds up if result would have a remainder #output #print "You need to cover ", area, " square feet" #print "You need ", mulch, " cubic yards of mulch" #exit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Understanding Group Leadership Culture and Group Leadership

Answered: 1 week ago