Question: // make sure code is in mips assembly and please make sure the whole program is complete thank you. please show output thanks. Write a

// make sure code is in mips assembly and please make sure the whole program is complete thank you. please show output thanks.

Write a program for a grocery store to calculate the total charge for customers.

In the main:

Your program should ask customer the number of items that he/she is purchasing and it should check to see it is less than or equal to 20 items , then your program should pass than number to FillPriceArray subroutine and call FillPriceArray subroutine.

FillPriceArray subroutine fills the array, accumulate the prices and return the sum to main.

In the main you get the number of coupons form user (it should be the same as the number of items) and pass the coupon number to FillCouponArray sub and call FillCouponArray to fill the CouponArray.

FillCouponArray sub gets the coupon amount. The coupon should be less than item price and coupon should not be more than $10 if the coupon is more than item price or exceed $10 then you place 0 in the CouponArray for that coupon. Also the FillCouponArray sub accumulates the coupons and return it to main. Finally your main program should calculate the total charge by subtracting the total price from total discount coupons and out put the total charge with a thank you massage on the screen.

Sample Output:

Please enter the number of item you are purchasing(should be less than or equal to 20)

21

Sorry too many items to purchase!! Please enter number of items you are purchasing

3

Please enter the price of item 1

10

Please enter the price of item 2

10

Please enter the price of item 3

20

Please enter the number of coupons that you want to use.

4

Too many Coupons!! Please enter the number of coupons that you want to use.

3

Please enter the amount of coupon 1

15

This coupon is not acceptable

Please enter the amount of coupon 2

$5

Please enter the amount of coupon 3

$5

Your total charge is: $30

Thank you for shopping with us.

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!