Simple Formula For C++

Why am I getting these random long numbers as a result?

Month:   March, 2013
----------------------------------
Total Collected:       $ 63924.62
Sales:                   60306.25
City Sales Tax:12061.25
State Sales Tax:24122.50
Total Sales Tax:36183.75
----------------------------------



1
2
3
4
5
6
7
8
9
const double CITY_TAX_RATE  = .02,
             STATE_TAX_RATE = .04,
             SALES_CUTOFF   = 100000,
             TAX_BREAK      = .10;

double sales,
       city_tax_owed,
       state_tax_owed,
       total_sales_tax;


1
2
3
4
sales = total_collected / 1.06;
city_tax_owed = sales * CITY_TAX_RATE;
state_tax_owed = sales * STATE_TAX_RATE;
total_sales_tax = city_tax_owed + state_tax_owed;


1
2
3
4
5
6
7
cont...
<< "Total Collected:" << fixed << setprecision(2) << setw(9) << "$ " << total_collected..
<< "Sales:" << setw(27) << sales <<endl
<< "City Sales Tax:" << city_tax_owed << endl
<< "State Sales Tax:" << state_tax_owed << endl
<< "Total Sales Tax:" << total_sales_tax << endl
<< "----------------------------------" << endl;

Last edited on
Where have you declared and initialized total_collected? please post the entir code
Topic archived. No new replies allowed.