This program will calculate an employees pay based on gross

This program will calculate an employee\'s pay based on gross salary and various deductions, (gotta love those deductions!) For this payroll program, you are to read data from an input file. The output, which is in the form of paystubs, should be written to an output file. File input data will be (in this order): SSN, Payrate, FHW%. number of dependents, and hours worked. (Here is an example of what your input file should look like.) File output will be a paystub similar to the one below. Pay overtime at 1 1/2 for hours over 40. For each dependent over 2, the cost of insurance is $12 per dependent. All deductions are calculated against Gross pay. Read all data from a text file. Use the constants defined later on this sheet. Use the functions defined below. Functions: main() call all functions and loop until EOF get_input() read all inputs calc_gross () pass necessary parameters and return gross pay. Calc_deducts() calculate all deductions print_paystub() pass necessary parameters and output a paystub which contains all the information listed in the paystub sample above. Constants to Define: FICA 4.75//this is percentage to deduct for social security OVERTIME 1.5//the amount to multiply overtime hours by REG_HRS 40.0//the number of hours required to work before getting overtime pay MAX_DEPENDENTS 2//the maximum number of dependents covered by normal insurance COST_PER_ADD 12.00//the cost of insurance for each dependent over MAX_DEPENDENTS

Solution

#include<iostream.h>
#include<conio.h>
#define SIZE 5
class emp
{
   float basic,da,it,netsal;
   char name[20],num[10];
   public:
       void getdata();
       void net_sal();
       void dispdata();

};

void emp::getdata()
   {
      cout<<\"\             Enter employee number: \" ;
      cin>>name;
      cout<<\"              Enter employee name: \" ;
      cin>>num;
      cout<<\"Enter employee basic salary in Rs: \" ;
      cin>>basic;
   }

void emp::net_sal()
   {
      da=((0.52)*basic );
      float gsal=da+basic;
      it=((0.3)*gsal);
      netsal=gsal-it;
   }

void emp::dispdata()
   {
      cout
           <<\"\       Employee number: \"<<name
           <<\"\         Employee name: \"<<num
           <<\"\    Employee netsalary: \"<<netsal<<\" Rs.\";

   }

void main()
{
   clrscr();
   emp ob[SIZE];
   int n;
   cout<<\"\ \ ***********************************\"
         <<\"\ Calculation of Employee Net Salary\"
         <<\"\ ***********************************\"
         <<\"\ Enter the number of employees\";
   cin>>n;
   for(int i=0;i<n;i++)
       {
           ob[i].getdata();
           ob[i].net_sal();
       }
     clrscr();
   cout<<\"\ -----------------\"
         <<\"\ Employee Detail::\"
         <<\"\ -----------------\";
   for( i=0;i<n;i++)
          {
           cout<<\"\ \ Employee:\"<<i+1
               <<\"\ ----------\";
           ob[i].dispdata();
          }
   getch();
}

 This program will calculate an employee\'s pay based on gross salary and various deductions, (gotta love those deductions!) For this payroll program, you are t
 This program will calculate an employee\'s pay based on gross salary and various deductions, (gotta love those deductions!) For this payroll program, you are t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site