Program help

What's up guys. I need help, idk what I'm doing wrong but I'm really frustrated, I'm new at this but I think I may be on the right track, but I still want to be sure.. if anyone can step by step tell what I'm doing wrong and/or guide me it would gladly be appreciated, thank you!

the output should read:

What is your pay per two-week period: 1700
If you make $1700 per period, over 26 periods, pay 7% payroll tax and 15% federal tax, your
gross income is $44200
payroll tax is $3094
federal tax is $6630
net income is $34476


my program:


#include <iostream>
using namespace std;

int main()
{

double paycheck, perperiod, grossincome, payrolltax, federaltax, netincome;

// two week pay period
paycheck = 1700;

// paid 26 times per year
perperiod = 26;

// pay 7% payroll tax
payrolltax = 7%;

// pay 15% federal tax
federaltax = 15%;

// multiply
grossincome = paycheck * perperiod;

payrolltax = perperiod * payrolltax;

federaltax = paycheck * federaltax;

// subtract
netincome = grossincome - payrolltax - federaltax;

// display
cout << "What is your pay per two-week period:" << paycheck << endl;
cout << "If you make $ " << paycheck;
cout << "per period, over " << perperiod;
cout << "periods, pay " << payrolltax;
cout << "payroll tax and " << federaltax;
cout << "federal tax, your\n";
cout << "gross income is $ " << grossincome = paycheck * perperiod;
cout << "payroll tax is $ " << payrolltax = perperiod * payrolltax;
cout << "federal tax is $ " << federaltax = paycheck * federaltax;
cout << "net income is $ " << netincome = grossincome - payrolltax - federaltax;

return 0;

}
make %int 0.int
a % means something else (modulo) and you can't do assignment in an output stream; just do the operation w/o the =
i think your declaration of percentage might be wrong. i have never tried declaring value of variable with percentage. you my want to try using float data type and declare your 7% as 0.07
thats what i said
thats what i said
+1
Woot!!! first +1
Topic archived. No new replies allowed.