Bagels Problem

Im having trouble with the calculations. This is the problem.

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.

So far i have this:

#include <iostream>
using namespace std;

int main()
int bagels;
double half_dozen;
double single_bagel;
double dozen_bagel;

half_dozen = 2.60;
single_bagel = .50;
dozen_bagel = 3.80;

cout << "How many bagels would you like today? ";
cin >> bagels;
if( (bagels%13==0) ){ cout <<

cout << "Thank you for your order." << endl;


return 0;
Topic archived. No new replies allowed.