Won't let me enter values

I know I did something wrong because I'm unable to enter values for the three questions to do the calculation. This is what I have so far. What am I doing wrong?

Put the code you need help with here.
#include <iostream>
using namespace std;
int main()
{
int payAmount, payPeriods, taxBracket, grossannualpay, netannualpay, taxAmount;

cout << "Enter employee's pay amount per period: " << endl;
cin >> payAmount;
cout << "Enter number of pay periods: " << endl;
cin >> payPeriods;
cout << "Enter employee's tax bracket (in fraction, i.e. 0.25 for 25%): " << endl;
cin >> taxBracket;

// calculating gross annual pay
grossannualpay = payAmount * payPeriods;
// calculating tax amount
taxAmount = taxBracket * grossannualpay;
// calculating net annual pay
netannualpay = grossannualpay - taxAmount;

//Displaying data
cout << "Employee's gross annual pay: $ " << grossannualpay << endl;
cout << "Employee's federal tax: $ " << taxAmount << endl;
cout << "Employee's net annual pay: $ " << netannualpay << endl;

return 0;
}
works perfectly for me. did you recompile it?
Last edited on
Yeah, but it only lets me enter the pay amount but not the pay periods or tax bracket.
I do not know what you are seeing but the code worked for me, all 3 fields.
I figured it out, I had to change the int to double since I had decimals
Topic archived. No new replies allowed.