#include <stdlib.h>
#include <iostream>
#include <stdio.h>
#include <cstdlib>
using namespace std;
int main()
{
int menuState;
int tax;
do
{
do
{
system("cls");
cout<<"Enter the Category Tax : "<<endl;
cout<<"1. Single"<<endl;
cout<<"2. Head of Household"<<endl;
cout<<"3. Married, Joint"<<endl;
cout<<"4. Married, Separate"<<endl;
cin>>tax;
} while (tax < 1 || tax > 4 );
switch(tax)
{
case 1:
{
float taxable_income;
system("cls");
cout<<"Enter the taxable income : ";
cin>>taxable_income;
if (taxable_income > 17850)
cout<<"Tax = $"<<17850 * 0.15 + 0.28 * (taxable_income - 17850)<<endl;
else
cout<<"Tax = $"<<taxable_income * 0.15<<endl;
system("pause");
} break;
case 2:
{
float taxable_income;
system("cls");
cout<<"Enter the taxable income : ";
cin>>taxable_income;
if (taxable_income > 23900)
cout<<"Tax = $"<<23900 * 0.15 + 0.28 * (taxable_income - 23900)<<endl;
else
cout<<"Tax = $"<<taxable_income * 0.15<<endl;
system("pause");
} break;
case 3:
{
float taxable_income;
system("cls");
cout<<"Enter the taxable income : ";
cin>>taxable_income;
if (taxable_income > 29750)
cout<<"Tax = $"<<29750 * 0.15 + 0.28 * (taxable_income - 29750)<<endl;
else
cout<<"Tax = $"<<taxable_income * 0.15<<endl;
system("pause");
} break;
case 4:
{
float taxable_income;
system("cls");
cout<<"Enter the taxable income : ";
cin>>taxable_income;
if (taxable_income > 14875)
cout<<"Tax = $"<<14875 * 0.15 + 0.28 * (taxable_income - 14875)<<endl;
else
cout<<"Tax = $"<<taxable_income * 0.15<<endl;
system("pause");
} break;
}
do
{
system("cls");
cout<<"Would you like to continue the calculation:"<<endl;
cout<<"1. Yes"<<endl;
cout<<"2. No"<<endl;
cin>>menuState;
} while (menuState < 0 || menuState > 2);
} while( menuState != 2);
return 0;
}
Comments
Leave a comment