vgvvvvvvvvvvvv
Last edited on
We're not here to do your homework. This forum is for those who need help with their code, not entire solutions.

Try doing it yourself and if you get stuck, post the code that you have with questions on what you don't understand
Last edited on
You have forgotten something.........

Your code, with code tags please - the <> button on the right.

And compiler output, if it doesn't compile.
this is what i had, but i figured it is completely wrong. i shouldn't use the if statements.

#include <iostream>
#include <math.h>
#include <string>

using namespace std;

int main()
{

// declare variables
int sinc; // Single income
int sinc; // Married Filing Jointly income
int hinc; // Head of Household income

double tax;

// get input from user
cout << "if you are single, how much do you earn? if not enter -1";
cin >> sinc;

cout << "if you are Married Filing Jointly, how much do you earn? if not enter -1";
cin >> minc;

cout << "if you are / Head of Household, how much do you earn? if not enter -1";
cin >> hinc;

// do computations (processing)

if (sinc > 0 && sinc <= 40,000)
{
inc = "1 accidents";
inc = .10;
}

else if (sinc > 40,000 && sinc <= 300,000)
{
asr = "2 accidents";
asrp = .25;
}
else if (sinc > 300,000)
{
asr = "3 accidents";
asrp = .35;
}
if (minc > 0 && minc <= 100,000)
{
asr = "1 accidents";
asrp = .10;
}

else if (minc > 100,000 && minc <= 300,000)
{
asr = "2 accidents";
asrp = .25;
}
else if (minc > 300,000)
{
asr = "3 accidents";
asrp = .35;

}
if (hinc > 0 && hinc <= 50,000)
{
asr = "1 accidents";
asrp = .10;
}

else if (hinc > 50,000 && hinc <= 300,000)
{
asr = "2 accidents";
asrp = .25;
}
else if (hinc > 300,000)
{
asr = "3 accidents";
asrp = .35;
}

cout << " can not insure" << endl;
system("PAUSE");
return 0;
}

// do processing

tax = income * sinc;

tax = income * minc;

tax = income * hinc;

// output results

system("PAUSE");
return 0;
}
Please use the <> source code format button -.-
Also with a quick look at the program,

 ``12`` ``````int sinc; // Single income int sinc; // Married Filing Jointly income ``````

You made a typo and declared the same variable twice.
Last edited on
i need help with the second step

 ``123456789101112131415161718192021222324252627282930313233343536`` ``````#include using namespace std; int main() { // declare data variables double r; // rate double tax; //tax double inc; //income // get input from user cout << "Enter rate: " << endl; cin >> r; cout << "Enter income: " << endl; cin >> inc; cout << endl << endl << endl; // do processing tax = inc * r; // output results cout << "The area is "; cout << tax << endl; system("PAUSE"); return 0; }``````
Last edited on
Ali's midterm?
yes
 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091`` ``````#include using namespace std; double tax(double income, double r) { return income * r; } double perc_tax(double income, char n) { double perc; if(n=='s') { if(income<40000){ perc=0.10;} else if (income>40000 && income<300000) perc = 0.25; else if (income>300000) perc=0.35; } else if(n=='m') { if(income<100000){ perc=0.10;} else if (income>100000 && income<300000) perc = 0.25; else if (income>300000) perc=0.35; } else if(n=='h') { if(income<50000){ perc=0.10;} else if (income>50000 && income<300000) perc = 0.25; else if (income>300000) perc=0.35; } return perc; } double deductDependants(double tax, int depCount) { double for(int i=1;i<=depCount;i++) { tax = tax-500; return (tax); } } int main() { double income,paid,deductedTax,refund,r; char filling; int depCount; cout<<"Enter Income \n"; cin>>income; cout<<"Enter the number of your dependants\n"; cin>>depCount; cout<<"Enter 's' if single, 'm' if married, 'h' if head of household.\n"; cin>>filling; r = perc_tax(income,filling ); paid = tax(income,r); deductedTax = deductDependants(paid,depCount); refund =deductedTax-paid; cout<<"income: "<0) cout<<"\nYou are Entitles to a refund of \$"<

made a faulty function `deductDependants()` and some other errors but hope it gives u a clue to the real thing
Last edited on
thank you, BridgesBenghazi!
Topic archived. No new replies allowed.