I have been trying to figure out the correct calculations for the this problem and can't seem to figure out how to get it right using the following information. I have posted my code below as well. I don't understand what to do to get the actual tax amount for any given income. This is probably more of a math issue, but any help would be appreciated!
'''
//Write a program that computes taxes.
#include <iostream>
#include<string>
using namespace std;
int main()
{
double tax1 = 0;
double tax2 = 0;
double tax3 = 0;
double income = 0;
string marital_status;
cout << "Please enter your income: ";
cin >> income;
cout << "Please enter s for single, or m for married: ";
cin >> marital_status;
if (marital_status == "s")
{
if (income <= 8000)
{
tax1 = income * .10;
}
else if (income <= 32000)
{
tax1 = income * .10;
tax2 = income * .15 + 800;
}
else
{
tax1 = income * .10;
tax2 = income * .15 + 800;
tax3 = income * .25 + 4400;
}
}
else
{
if (income <= 16000)
{
tax1 = income * .10;
}
else if (income <= 64000)
{
tax1 = income * .10;
tax2 = income * .15 + 1600;
}
else
{
tax1 = income * .10;
tax2 = income * .15 + 1600;
tax3 = income * .25 + 8800;
}
}
double total_tax = tax1 + tax2 + tax3;
cout << "The tax is $" << total_tax << endl;
return 0;
}
'''