Question: Write a MIPS assembly code using branch and syscall instructions: Here are the sample outputs: Assignment Description: Write a MIPS assembly language program that reads

Write a MIPS assembly code using branch and syscall instructions:

Write a MIPS assembly code using branch and syscall instructions: Here are

Here are the sample outputs:

the sample outputs: Assignment Description: Write a MIPS assembly language program that

Assignment Description: Write a MIPS assembly language program that reads a customer's current and previous meter readings of electricity and a month to compute its electricity bill. If a customer spent 0 or less (technically this should not happen, though) KWH (kilowatt-hours) that is computed by current meter reading previous meter reading, then the program should print out "There is no bill to pay.ln". If a customer spent less than or equals to 300 KWH in a month, then the payment should be 20 dollars If a customer spent more than 300 KWH in a month of May, June, July, August, or September, then the payment is computed by: payment-20 + (used KWH - 300)/15; If a customer spent more than 300 KWH in any other month, then the payment is compute payment 20 int currentleter + (use KWH- 300) /20 int usedKH; int month; int payment; printf("Please enter the current electricity meter reading: "); Then ifthe //read an integer from a user input and store it in currentMeter scanf("%d" , &currentMeter printf("Please enter the previous electricity meter reading: In"); greater than //read an integer from a user input and store it in previousMeter scanf("%d", &previou sMeter); print out the paymen amount, along with its used KWH. printf("Please enter a month to compute their electricity bill, "; printf("Use an integer between 1 and 12 (1 for January, etc.): "); //read an integer from a user input and store it in month scant("%d", &month); usedKNH = currentleter previousMeter; - The following shows howit c looks like in a C program printf("There is no bi1l to pay. "); else //compute its bill if (usedKWH 300 && month >. 5 && month 9) payment 20 (usedKMH-300)/15; = + else payment 20 (usedKNH-300)/20; + //print out the payment printf("Your total payment for this month: %d dollar(s) for %d Hiin", payment, usedKAH) ; //end of else

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!