Please enter the number of item you are purchasing: 21 Sorry, too many items to purchase!! Please enter number of items you are purchasing: 3 Please enter the price of item 1: Please enter the price of item 2: Please enter the price of item 3: Please enter the amount of coupon 1: This coupon is not acceptable 10 10 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 Your total charge is: $30 Thank you for shopping with us. 15 Please enter the amount of coupon 2: 5 Please enter the amount of coupon 3: 5 LO 11
I need help please to write a
algorithm:
1. In the main:
a) ask customer for the number of items that they are purchasing
b) check to see it is less than or equal to 20 items
c) pass than number to FillPriceArray subroutine and call FillPriceArray subroutine.
2. FillPriceArray subroutine:
a) fill the array and accumulate the prices sub total
b) return the sub total to main.
3. In the main:
a) ask customer for the number of coupons (it should be the same as the number of
items)
b) pass the coupon number to FillCouponArray subroutine and call FillCouponArray
subroutine to fill the CouponArray.
4. FillCouponArray subroutine:
a) fills the array and accumulate the discount total
*get 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.
b) return coupon sum to main
5. In the main:
a) calculate the total charge by subtracting the total price from total discount coupons
b) out put the total charge with a thank you massage on the screen.
Step by step
Solved in 4 steps with 3 images