Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a MIPS assembly code using branch and syscall instructions: Also, here are the sample outputs: Assignment Description: Write a MIPS assembly language program that
Write a MIPS assembly code using branch and syscall instructions:
Also, here are the sample outputs:
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" , ¤tMeter 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 elseStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started