a) A local shop sells festival cookies at RM28.50 per box. The shop offers special discount for order of 20 boxes or more as shown helowa: Number of boxes Discount on total price More than 100 25% 80-100 20% 50-79 15% 20-49 10% Write a fragment of C++ code to accept the order quantity in boxes, then calculates and displays the total discount (if applicable) and total cost of the order. Prompts error message if invalid quantity is entered (zero or below). Display the total cost in 2 decimal places. Sample program run 1: Enter number of boxes you wish to order : -10 Sorry. Invalid order quantity. Sample program run 2: Enter number of boxes you wish to order: 50 Total discount is RM213.75 Total cost is RM1211.25

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

C++ Programming

a) A local shop sells festival cookies at RM28.50 per box. The shop offers special discount for
order of 20 boxes or more as shown belows:
Number of boxes
Discount on total price
More than 100
25%
80-100
20%
50-79
15%
20-49
10%
Write a fragment of C++ code to accept the order quantity in boxes, then calculates and
displays the total discount (if applicable) and total cost of the order. Prompts error message if
invalid quantity is entered (zero or below). Display the total cost in 2 decimal places.
Sample program run 1:
Enter number of boxes you wish to order : -10
Sorry. Invalid order quantity.
Sample program run 2:
Enter number of boxes you wish to order: 50
Total discount is RM213.75
Total cost is
RM1211.25
Transcribed Image Text:a) A local shop sells festival cookies at RM28.50 per box. The shop offers special discount for order of 20 boxes or more as shown belows: Number of boxes Discount on total price More than 100 25% 80-100 20% 50-79 15% 20-49 10% Write a fragment of C++ code to accept the order quantity in boxes, then calculates and displays the total discount (if applicable) and total cost of the order. Prompts error message if invalid quantity is entered (zero or below). Display the total cost in 2 decimal places. Sample program run 1: Enter number of boxes you wish to order : -10 Sorry. Invalid order quantity. Sample program run 2: Enter number of boxes you wish to order: 50 Total discount is RM213.75 Total cost is RM1211.25
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Datatypes
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.
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