Develop a C++ program that will determine the gross pay and net pay (after taxes
ID: 3888820 • Letter: D
Question
Develop a C++ program that will determine the gross pay and net pay (after taxes). Each employee pays a flat tax of 150.00 on the first 1000.00 dollars earned. If the employee earns less than 1000.00 dollars then he/she pays no taxes. Taxes are computed at 15.5% on all earnings over 1000.00 dollars if the number of dependents is 3 or less and 12.5% if the number of dependents are 4 or more.
Sample input/outpt dialog
Enter # of yours worked: 99.99
Enter rate of pay: 10.00
Enter number of dependents: 2
Results
Gross salary is: $9999.99
Taxes withheld: $99.99
Salary after taxes: $999.99
Explanation / Answer
#include <iostream>
using namespace std;
int main()
{
double worked, rate;
int d;
double tax=0, taxRate;
cout<<"Enter # of yours worked: ";
cin >> worked;
cout<<"Enter rate of pay: ";
cin >> rate;
cout<<"Enter number of dependents: ";
cin >> d;
if (worked > 1000) {
tax = 150;
if( d >= 4) {
taxRate=12.5;
} else {
taxRate=15.5;
}
tax = tax + ((worked-1000)*taxRate)/100;
}
cout<<"Gross salary is: $"<<(worked*rate)<<endl;
cout<<"Taxes withheld: $"<<tax<<endl;
cout<<"Salary after taxes: $"<<(worked*rate - tax)<<endl;
return 0;
}
Output:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.