Question

Write a C++ program to read N employees’ weekly hours and rate per hour of type...

Write a C++ program to read N employees’ weekly hours and rate per hour of type of double. Compute gross salary. If gross salary is greater than $1,000.00 and less than $2,000.00, then deduct 30% tax. If gross salary is less than or equal to $1,000, then deduct 15% tax; otherwise, deduct 35% tax. Display all information. Use function for each action. Your program should include the following functions:

• Main() • Read_Data () // it is called twice for weekly hour and rate

• Compute_Gross_Salary() // it accepts weekly hour and rate as input

• Compte_Tax() // it accepts Gross Salary as input

• Compute_Net_Salary() // it accepts Gross Salary and Tax as input

• Disply_Info () // Accepts one input

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>

using namespace std;


int Read_Data(){
int n;
cin>>n;
return n;
}
int Compute_Gross_Salary(int h,int r){
return h*r;
}
int Compte_Tax(int sal){
   if(sal>1000 && sal<2000)
       return sal*0.3;
   if(sal<1000)
       return sal*0.15;
   return sal*0.35;

}
int main(){
int n;
cout<<"Enter number of employees ";
cin>>n;
int *hours=new int[n];
int *rate=new int[n];
int *sal=new int[n];
int r,h;
for(int i=0;i<n;i++){
   cout<<"Enter number of hours";
   hours[i]=Read_Data();
   cout<<"Enter rate ";
   rate[i]=Read_Data();
   sal[i]=Compute_Gross_Salary(hours[i],rate[i]);
}
cout<<"Gross Salary\tTax\tNetSalary"<<endl;
for(int i=0;i<n;i++){
   double t=Compte_Tax(sal[i]);
   cout<<sal[i]<<"\t\t"<<t<<"\t"<<sal[i]-t<<endl;
}

}

Add a comment
Know the answer?
Add Answer to:
Write a C++ program to read N employees’ weekly hours and rate per hour of type...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT