Computing question
Jun 28, 2011 at 11:03pm UTC
My code is computing taxes. The user inputs how they are filing and their taxable income. If the user inputs a 1 (married jointly) I need thattax to calculate as 83% of the total tax rate of a singe filer. This will be inputted under the else if ( status == 1) statement. Could someone get me started and show me how to make married jointly output 83% of the tax rate of a single filer? Thanks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
#include <iostream>
using namespace std;
int main()
{
//prompt the user to enter filling status
cout << "Enter the filing status\n"
<< "(0-single filer, 1-married jointly,\n"
<< "2-married seperatly, 3-head of household): " ;
int status;
cin >> status;
// Prompt the user to enter taxable income
cout << "Enter the taxable income: " ;
double income;
cin >> income;
// Compute Tax
double tax = 0;
if ( status == 0)
{
//compute tax for single filer
if (income <= 6000)
tax = income * 0.10;
else if (income <= 27950)
tax = 6000 * 0.10 + (income - 6000) * 0.15;
else if (income <= 67700)
tax = 6000 * 0.10 + (27950 - 6000) * 0.15 + (income - 27950) * 0.27;
else if (income <= 141250)
tax = 6000 * 0.10 + (27950 - 6000) * 0.15 + (67700 - 27950) * 0.27 + (income - 67700 * 0.30);
else if (income <= 307050)
tax = 6000 * 0.10 + (27950 - 6000) * 0.15 + (67700 - 27950) * 0.27 + (141250 - 67700) * 0.30 + (income - 141250) * 0.35;
else
tax = 6000 * 0.10 + (27950 - 6000) * 0.15 + (67700 - 27950) * 0.27 + (141250 - 67700) * 0.30 + (307050 - 141250) * 0.35 + (income - 307050) * 0.386;
}
else if (status == 1)
{
}
else if (status == 2)
{
}
else if (status == 3)
{
}
else
{
cout << "Error: invalid filing status " ;
return 0;
}
//Display results
cout << "Tax is " << static_cast <int >(tax * 100) / 100.0 << endl;
return 0;
}
Topic archived. No new replies allowed.