Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MARS Program must be in MIPS. I don\'t understand this. It\'s not as simple as j

ID: 3761953 • Letter: M

Question

MARS Program must be in MIPS. I don't understand this. It's not as simple as just converting it from java to mips.

Write a program to calculate the number of gallons of paint needed to paint a room. Assume that a gallon covers 350 square feet. Assume that you are painting two coats on all four walls. You are painting one coat on the ceiling, using ceiling paint which is a different kind of paint. Remember that if there is any fractional part when calculating the number of gallons you need to round up so you are sure to have enough paint.

Input:

length of room (in feet)

width of room (in feet)

height of ceiling (in feet)

price of a gallon of paint (assume same price for wall paint and ceiling paint)

Output:

your name

total number of square feet of walls

number of gallons of wall paint needed

total number of square feet of ceiling

number of gallons of ceiling paint needed

cost of paint

Make sure your program includes comments. You need comments at the top with your name and lab number, and a comment for every line of executable code.

Explanation / Answer

FOR: beq $t0, $t1, EndFOR IF: jal test_prime bne $s1, 1, EndIF addi $s0, $s0, 1 #Increment 'c'. #Print 'c', the nth counted place of the found Prime Integer. li $v0, 1 move $a0, $s0 syscall sw $s0, buffer($0) li $v0, 15 move $a0, $s7 la $a1, buffer li $a2, 1 syscall #Print '.) ' li $v0, 4 la $a0, dotP syscall li $v0, 15 move $a0, $s7 la $a1, dotP li $a2, 3 syscall #Print the Prime integer, 'i'. li $v0, 1 move $a0, $t0 syscall #Print a New Line. li $v0, 4 la $a0, newL syscall li $v0, 15 move $a0, $s7 la $a1, newL li $a2, 1 syscall EndIF: IF2: beq $s0, 100, EndFOR #Once 100 Prime Integers have been found, escape out of the 'For' loop. EndIF2: #Not Necessary, but just there to have a complete coding style.