Extra Credit Betty's Bagelry

 

Betty's Bagelry charges  $3.80 for a baker's dozen of bagels (13 bagels).  The price for half a dozen (6 bagels) is $2.60.  A single bagel costs $ .50.  Betty is an honest merchant.  Customers always get the best price on an order, even if they get more bagels than ordered.  For example, a customer that orders 10 bagels would pay $4.60 (2.60 for a half dozen bagels plus $2.00 for 4 single bagels.  Betty gives her customers 13 bagels, saving the customer $.80. 

 

Write a C++ program that will help Betty help her customers.  Your program prompts the user for the number of bagels.  If then calculates the customer's  payment two ways.  First it finds the price of the smallest multiple of 13 bagels that is closest to the customer's order.  It then calculates the price of the customer's order so that the customer's payment is the smallest amount possible with the customer getting the exact number of bagels ordered.  If the first method is the smallest amount the program outputs the number of bagels the customer will receive along with the dollar amount owed, and the dollar amount  saved.  Otherwise just print the number of bagels received and the dollar amount owed. 

 

Print all dollar amounts to two decimal spaces.

 

Test your program on the following inputs and two of your own.  Make sure you test for all logical possibilities.

 

10 bagels

24 bagels

13 bagels

14 bagels

 

Sample output:

 

How many bagels would you like today? 10

Thank you for your order.

You will receive 13 bagels  instead of 10 for a savings of $0.80.

Please pay the cashier $3.80

Press any key to continue

 

How many bagels would you like today? 24

Thank you for your order.

You will receive 26 bagels  instead of 24 for a savings of $1.30.

Please pay the cashier $7.60

Press any key to continue

 

How many bagels would you like today? 13

Thank you for your order.  Please pay the cashier $3.80

Press any key to continue

 

How many bagels would you like today? 14

Thank you for your order.  Please pay the cashier $4.30

Press any key to continue