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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I need help please to write a program for a grocery store to calculate the total charge for customers following this
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.

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:
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
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.
Transcribed Image Text: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: 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 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.
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
ListBox
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education