A company wants you to write a C++ program that allows the user to input 10 empl
ID: 651662 • Letter: A
Question
A company wants you to write a C++ program that allows the user to input 10 employee names, hourly rate and hours worked into 3 arrays. Program should compute each employees gross pay, using tax withholding percentage as shown below; tax withholding amount, and net pay (gross pay minus tax withholding). Display all the results for each employee. The end program should display the total of all hours worked, the total gross pay, the total tax withholding for all employees and total net pay.
Weekly Gross Pay Withholding Percentage
0.00 to 300.00 10
300.01 to 550.00 13
550.01 to 800.00 16
800.01 and up 20
Explanation / Answer
#include<iostream.h>
using namespace std;
int main()
{
double totalhoursrate=0.0;
double tax;
str name;
cout<<"enter employee name";
for(int i=0;i<10;i++)
{
cin>>name[i]
}
cout<<"enter Hourly rate";
int weakly=0;
for(int i=0;i<10;i++)
{
cin>>hourlyrate[i];
for(int i=0;i<7;i++)
{
weekly[i]=weakly[i]+hourlyrate[i];
}
double totalhoursrate=totalhoursrate+hourlyrate[i];
}
cout<<"totalhoursworked is"<<totahoursrate;
cout<<"enter hours worked";
for(int i=0;i<10;i++)
{
cin>>hoursworked[i];
double totalhoursworked=totalhoursworked[i]+hoursworked[i];
}
cout<<"totalhoursworked is"<<totahoursworked;
cout<<"weakly pay";
for(int i=0;i<10;i++)
if(weakly[i]<300 && weakly[i]>0)
{
cout<<"tax is";
tax[i]=[(weekly[i]*10)/100];
cout<<"tax for 10%"<<tax[i];
grosssalary[i]=(weekly[i]*4);
netsalary[i]=((weekly[i]-tax[i])*4);
cout<<"net salary"<<salary[i];
cout<<"gross salary"<<grosssalary[i];
}
if(weakly[i]>300.01 && weakly[i]<550.00)
{
for(int i=0;i<10;i++)
tax[i]=((weekly[i]*13)/100);
cout<<"tax for 13%"<<tax[i];
grosssalary[i]=(weekly[i]*4);
netsalary[i]=((weekly[i]-tax[i])*4);
cout<<"net salary"<<salary[i];
cout<<"gross salary"<<grosssalary[i];
}
if(weakly[i]>550.01 && weakly[i]<800.00)
{
for(int i=0;i<10;i++)
tax[i]=((weekly[i]*16)/100);
cout<<"tax for 16%"<<tax[i];
grosssalary[i]=(weekly[i]*4);
netsalary[i]=((weekly[i]-tax[i])*4);
cout<<"net salary"<<salary[i];
cout<<"gross salary"<<grosssalary[i];
}
if(weakly[i]>800.00)
{
for(int i=0;i<10;i++)
tax[i]=((weekly[i]*20)/100);
cout<<"tax for 20%"<<tax[i];
grosssalary[i]=(weekly[i]*4);
netsalary[i]=((weekly[i]-tax[i])*4);
cout<<"net salary"<<salary[i];
cout<<"gross salary"<<grosssalary[i];
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.