Okay so here is what the program is supposed to do:
“This program estimates the social security deduction (for an
imaginary country) where people who earn less than $1,500 a week
pay a certain rate (.136) , people who earn $1,500 or more, pay the same
rate up to $1,500 and then pay a lower rate (.056) on the additional
income they've earned.
The program will prompt a user for an hourly wage and whether or not the user
works a standard 40 hours a week (as a y/n question).
If the user indicates that he or she works a different number of hours,
they should be promted for how many hours they work
The program then will output the total weekly wage and
the amount of social security deducted.”
This is the actual program I have written and I can’t figure out what I am doing wrong:
The program first asks the user to “Enter your hourly wages.” (this is what it is supposed to do)
Then you type an amount in and then it asks “Do you work a standard 40 hour week?”
BUT THEN it asks to press any key to continue and it closes the program!!
Can anyone give me some tips?? I have been at this for about 5 hours now! Here it is:
Code:#include <iostream> using namespace std; int main() { cout<< "Enter your hourly wages: "; double hourlywage; cin>> hourlywage; cout << "Do you work a standard 40 hour week? (Y/N): " ; char Answer; cin>> Answer; double SocialSecurity; double weeklywages; if ( Answer == 'Y') { ((40 * hourlywage) == weeklywages) ; (( weeklywages * .136 ) == SocialSecurity) ; cout<< "Your weekly wages total "<< weeklywages << "." <<endl; cout<< "The total amount of Social Security deducted is " << SocialSecurity << "."<< endl; } else if (Answer = 'N' { cout<< "How many hours do you work per week?" ; double hoursweekly; cin>> hoursweekly; double weeklywages2; (( hourlywage * hoursweekly) = weeklywages2) ; if (weeklywages2 < 1500) // if their weekly wages are LESS THAN 1500 { ((weeklywages2 * .136) == SocialSecurity) ; cout<<"Your weekly wages total "<< weeklywages2 <<"."<<endl; cout<<"The total amount of Social Security deducted is " << SocialSecurity << "."<<endl; } else if (weeklywages2 >= 1500 { double amountover; double SocialSecurity1; double SocialSecurity2; double TotalSS; (( weeklywages2 - 1500) = amountover) ; (( 1500 * .136 ) == SocialSecurity1) ; (( amountover * .056 ) = SocialSecurity2) ; (( SocialSecurity1 + SocialSecurity2 ) = TotalSS); cout <<"Your weekly wages total " << weeklywages2 << "." << endl; cout <<"The total amount of Social Security deducted is " << TotalSS << "."<< endl; } system("pause"); return 0; }}