Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is to be written using the MARS simulator for the MIPS processor. Please try to make the output for your solution look as similar
This is to be written using the MARS simulator for the MIPS processor.
Please try to make the output for your solution look as similar to the sample input and output to the instructions.
It is important to keep the program as short and as simple as possible.
I will upvote a correct solution, but if it is wrong I will down vote until it is corrected. Thank you in advance!
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 CouponArra 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 vou 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. t es ai irskmy ate the ices 4b hoay o fill be be more than S10 if the couporAso the FillCouponArray sl b aal charge by 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 Please enter the price of item 1 10 Please enter the price of item 2 10 Please enter the price of item 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 S5 Please enter the amount of coupon 3 $5 Your total charge is: S30 Thank you for shopping with usStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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