Answer to Question #48787 in C++ for ama nae

Question #48787
The 1988 United States Federal Tax Schedule was the simplest in recent times. It had four categories, and each category had two rates. Here is a summary (dollar amounts are taxable income):

Category Tax
Single 15% of first $17,850 plus 28% of excess
Head of Household 15% of first $23,900 plus 28% of excess
Married, Joint 15% of first $29,750 plus 28% of excess
Married, Separate 15% of first $14,875 plus 28% of excess

For example, a single wage earner with a taxable income of $20,000 owes 0.15 x $17,850 + 0.28 x ($20,000- $17,850). Write a program that lets the user specify the tax category and the taxable income and that then calculates the tax. Use a loop so that the user can enter several tax cases.
1
Expert's answer
2014-11-11T00:38:50-0500
#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;
}


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS