Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am having an issue running this C++ after compiling it: The directions were: If gross pay is more $1000, the tax rate is 30%.
I am having an issue running this C++ after compiling it:
The directions were:
- If gross pay is more $1000, the tax rate is 30%.
- If the gross pay is more than $800.00 and less than or equal to $1000.00, then the tax rate is 20%.
- If the gross pay is more than $500.00 and less than $800.00 then the tax rate is 10%
- If gross pay is more than or equal to 0 and less than or equal to 500 tax rate is 0.
Here is what I wrote on the Dev-C++ Compiler:
1. #include2. using namespace std; 3. main(){ 4. int hw, empid; 5. float hr, gp, np, taxrate, taxamt; 6. while( cin >> empid >> hw >> hr ){ 7. gp = hw * hr; 8. if( gp > 1000 ) taxrate = 0.30; 9. else if( gp > 800 ) taxrate = 0.20; 10. else if( gp > 500 ) taxrate = 0.10; 11. else taxrate = 0.0; 12. taxamt = gp * taxrate; 13. np = gp - taxamt; 14. cout << "EMPLOYEE ID IS " << empid << endl; 15. cout << "HOURS WORKED ARE " << hw << endl; 16. cout << "HOURLY RATE IS " << hr << endl; 17. cout << "GROSS PAY IS " << gp << endl; 18. cout << "TAX AMOUNT IS " << taxamt << endl; 19. cout << "NET PAY IS " << np << endl << endl; 20. }//WHILE 21. return 0; 22. }//MAIN
4B) Compute the overtime pay according to the following formula:
Any hours over 40 are considered time and a half (overtime). You may want to find overtime hours (e.g. hoursworked 40) and overtime pay (e.g. overtimehours*hourlyrate * 1.5).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started