Question Details

(Solved) Hi guys! I needed to create a program to compute federal personal income taxes. Requirements that I am to follow:


Hi guys!

Really need some help with my school project!

I needed to create a program to compute federal personal income taxes.

Requirements that I am to follow:

"Your program should be modular, that is small blocks of code. (Later in the semester when we encounter functions, you will see how handy modular development can be.) You are to follow these specifications as closely as possible. You should have code blocks that do the following:

1. Input status code. You should use a do/while loop to control the input logic. You are to keep the user in the loop until the input is correct. You are to ensure that the status codes are as specified above.

2. Input taxable income. As in step 1, you are to use a do/while loop for this logic. You are to keep the user in the loop until the input is valid.Calculate the tax owned as a result of status code and taxable income. You are to use a switch statement for the appropriate logic for each status code. You should manually calculate several cases to ensure your program is performing correctly.

3. Display the results of the calculation step. You are to output the status code, the string description of the status code, the taxable income, and the total tax amount. You are to use appropriate formatting of the output.

4. You main loop should be a while loop that repeat steps 1 through 4 until the user enters a status code of 9 that will terminate the job."


What I came up with:

//***************************************************
//This Pogram computes federal personal income taxes.
//The filing status and income are input by the User.
//***************************************************

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
int statusCode; //variable declaration for input
float taxableIncome, 
float taxAmt;


//Prompt the User to enter filing status and income


while (statusCode !=9)
{
do
{ 
cout << "Enter your filing status by a number 1 through 4 where: "<< endl; 
cout << " 1 = single" << endl;
cout << " 2 = married filing jointly" << endl; 
cout << " 3 = married filing separately" << endl;
cout << " 4 = head of household" << endl;
cout << "Enter 9 if you want to end the process" << endl;
cin >> statusCode;

if (statusCode != 1 && statusCode != 2 && statusCode != 3 && statusCode != 4 && statusCode != 9)
cout << "Your filing status must be 1 through 4 or 9 if you want to end this program" << endl;

} while (statusCode != 1 && statusCode != 2 && statusCode != 3 && statusCode != 4 && statusCode != 9);

do
{
cout << "Now enter your yearly imcome that must be more than $3000. Example: 96230 if you made $96230" << endl;
cin >> taxableIncome;

if (taxableIncome <= 3000)
cout << "Your taxable income must be more than $3000" << endl;

//Filing status 1 - Single

switch (statusCode = 1)
{
case 1: if ( statusCode = 1 && taxableIncome <= 7550)
taxAmt = taxableIncome * 0.12;
break;
case 2: if ( statusCode = 1 && taxableIncome >= 7551 && taxableIncome <= 30650)
taxAmt = taxableIncome * 0.16;
break;
case 3: if ( statusCode = 1 && taxableIncome >= 30651 && taxableIncome <= 74200)
taxAmt = taxableIncome * 0.20;
break;
case 4: if ( statusCode = 1 && taxableIncome >= 74201 && taxableIncome <= 154800)
taxAmt = taxableIncome * 0.28;
break;
case 5: if ( statusCode = 1 && taxableIncome >= 154801 && taxableIncome <= 336550)
taxAmt = taxableIncome * 0.32;
break;
case 6: if ( statusCode = 1 && taxableIncome >= 336551)
taxAmt = taxableIncome * 0.40;
break;
}

//Filing status 2 - Married filing jointly

switch (statusCode = 2)
{ 
case 1: if ( statusCode = 2 && taxableIncome <= 15100) 
taxAmt = taxableIncome * 0.12;
break;
case 2: if ( statusCode = 2 && taxableIncome >= 15101 && taxableIncome <= 61300)
taxAmt = taxableIncome * 0.16;
break;
case 3: if ( statusCode = 2 && taxableIncome >= 61301 && taxableIncome <= 123700)
taxAmt = taxableIncome * 0.20;
break;
case 4: if ( statusCode = 2 && taxableIncome >= 123701 && taxableIncome <= 188450)
taxAmt = taxableIncome * 0.28;
break;
case 5: if ( statusCode = 2 && taxableIncome >= 188451 && taxableIncome <= 336550)
taxAmt = taxableIncome * 0.32;
break;
case 6: if ( statusCode = 2 && taxableIncome >= 336551)
taxAmt = taxableIncome * 0.40;
break;
}

//Filing status 3 - Married filinf separately

switch (statusCode = 3)
{
case 1: if ( statusCode = 3 && taxableIncome <= 7550) 
taxAmt = taxableIncome * 0.12;
break;
case 2: if ( statusCode = 3 && taxableIncome >= 7551 && taxableIncome <= 30650)
taxAmt = taxableIncome * 0.16;
break;
case 3: if ( statusCode = 3 && taxableIncome >= 30651 && taxableIncome <= 61850)
taxAmt = taxableIncome * 0.20;
break;
case 4: if ( statusCode = 3 && taxableIncome >= 61851 && taxableIncome <= 94225)
taxAmt = taxableIncome * 0.28;
break;
case 5: if ( statusCode = 3 && taxableIncome >= 94226 && taxableIncome <= 168275)
taxAmt = taxableIncome * 0.32;
break;
case 6: if ( statusCode = 3 && taxableIncome >= 168276 )
taxAmt = taxableIncome * 0.40;
break;
}

//Filing status 4 - Head of the Household

switch (statusCode = 4)
{
case 1: if ( statusCode = 4 && taxableIncome <= 10750) 
taxAmt = taxableIncome * 0.12;
break;
case 2: if ( statusCode = 4 && taxableIncome >= 10751 && taxableIncome <= 41050)
taxAmt = taxableIncome * 0.16;
break;
case 3: if ( statusCode = 4 && taxableIncome >= 41051 && taxableIncome <= 106000)
taxAmt = taxableIncome * 0.20;
break;
case 4: if ( statusCode = 4 && taxableIncome >= 106000 && taxableIncome <= 171650)
taxAmt = taxableIncome * 0.28;
break;
case 5: if ( statusCode = 4 && taxableIncome >= 171651 && taxableIncome <= 336550)
taxAmt = taxableIncome * 0.32;
break;
case 6: if ( statusCode = 4 && taxableIncome >= 336551 )
taxAmt = taxableIncome * 0.40;
break;
}

cout << "Filing status: " << statusCode << endl;
cout << "Taxable income: " << taxableIncome << endl;
cout << "Tax amount: " << taxAmt << endl;

} while (taxableIncome <= 3000);

system("pause"); //pause system to see the results
return 0;

} 

} //main function ends


It won't run! I can't figure out what I am doing wrong =(

Thank you in advance! 

 


Solution details:
STATUS
Answered
QUALITY
Approved
ANSWER RATING

This question was answered on: Sep 05, 2019

PRICE: $15

Solution~000200146627.zip (25.37 KB)

Buy this answer for only: $15

This attachment is locked

We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free copy from our tutoring website www.aceyourhomework.com (Deadline assured. Flexible pricing. TurnItIn Report provided)

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Sep 05, 2019

EXPERT

Tutor

ANSWER RATING

GET INSTANT HELP/h4>

We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

  • As a reference for in-depth understanding of the subject.
  • As a source of ideas / reasoning for your own research (if properly referenced)
  • For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

NEW ASSIGNMENT HELP?

Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.

WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN YOUR SET DEADLINE.

Order Now