Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1) [12 points] You've been hired by Breakfast Buddies to write a CH console application that calculates and displays the cost of a customer's granola
1) [12 points] You've been hired by Breakfast Buddies to write a CH console application that calculates and displays the cost of a customer's granola bar purchase. Each box of granola bars contains a dozen bars. Use a validation loop to prompt for and get from the user the number of boxes purchased in the range 1-6. Then use a validation loop to prompt for and get from the user the coupon discount in the whole number range 0-40%. At $3.50 per box, calculate the cost of the purchase minus the discount. Also calculate the sales tax (6%) and total sale amount. Use formatted output manipulators (setw, left/right) to print the following nine rows: Boxes Bars Discount Sale amount before discount Discount amount Sale amount after discount Tax rate Tax amount Sale total And two columns: A left-justified label (including units) A right-justified value. Define constants for the bars per box, cost per box, sales tax, and column widths. Format all real numbers to two decimal places. The output should look like this: Welcome to Breakfast Buddies - - - - Enter the number of boxes purchased (1-6): 8 Error: '8' is an invalid number of boxes. Enter the number of boxes purchased (1-6): 4 Enter the percentage discount (0-40): 60 Error: '60%' is an invalid percentage discount. Enter the percentage discount (0-40): 20 00 Boxes: Bars: Discount (%): Sale amount before discount ($): Discount amount ($): Sale amount after discount ($): Tax rate: Tax amount ($): Sale total ($): 20 14.00 2.80 11.20 0.06 0.67 11.87 End of Breakfast Buddies
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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