Question
66 views

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 passthan number to FillPriceArray subroutine.

FillPriceArray subroutine fills the array, accumulate the prices and returnthe sumto main.

In the main you get the number of couponsform user (it should be the same as the number of items)and pass the coupon number to FillCouponArray  function.

FillCouponArray function 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 function 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

Thank you for shopping with us.

check_circle

Step 1

Some definitions required to know before doing this program: -

1.What is Mars?

2.What is MIPS?

3.What is MARS MIPS Simulator

Let’s us explain one by one-

Mars: It’s an Integrated Development Environment for Mips (Microprocessor without Interlocked Pipelined Stages) Assembly Language Programming to perform the mips various tasks in the Processor.

Mips (Microprocessor without Interlocked Pipelined Stages): Its used to measure the computer performance, how much a computer can do a work more than one simultaneously in same time. It’s also used to calculate the measurement of cost of computing. The speed of the computer is measured by the MIPS.

MARS MIPS Simulator is an assembly language editor, or you can say it’s an IDE for the MIPS instructions.

1. To ask customer the number of items that is purchasing and check that is it less than or equal to 20 items or not and after then it should bs pass to FillPriceArray subroutine.
2. FillPriceArray should be fills the array accumulate the price of the items and then its return to the main fu...

Want to see the full answer?

See Solution

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in