Has to be done in c include files include include include i

Has to be done in c++.


// include files
#include
#include
#include
#include

using namespace std;

// declare constants here
const double FICA = 4.75;
const double OVERTIME = 1.5;
const double REG_HRS = 40.0;
const double MAX_DEPENDENTS = 2;
const double COST_PER_ADD = 12.00;

// function prototypes go here

void get_input(infile);
double calc_gross(double, double);

void print_paystub (double, double, double, double, double, double, double);

int main()
{
    // declare variables
    int ssn;
    double payrate;
    double fwh_percentage;
    int dependents;
    double hours_worked;
   
    double gross_pay;
    double net_pay;
    double deduction_total;
   
    double fwh_amount;
    double insurance_amount;
    double fica_amount;

    // declare files
    ifstream infile;
    ofstream outfile;
   
   
    // open files
   infile.open(\"paystub_input.txt\");
   outfile.open(\"paystub_output.txt\");

    // call get_input
       
       
    while(!infile.eof())
    {

        // call calc_gross
       
        // call calc_deducts
       
        // net_pay = gross_pay - deduction_total
       
        // call print_paystub
   
        // call get_input   
                   
    }


    // close files
   
    system(\"pause\");
    return 0;
}
   

/*************************************************
function get input

parameters: (All parameters passed by reference)
            ssn, payrate, fwh_percentage,
            dependents, hours_worked, infile

**************************************************/

void get_input()
{
    // input in order ssn, payrate, fwh_percentage,
    //       dependents, hours_worked  
        
}  
   
  
/**************************************************
   function: calc_gross

   parameters: (value)
               payrate
               hours_worked  
  
***************************************************/

double calc_gross(double payrate, double hours_worked)
{
   double overtime_hours;
   double regular_hours;
   double gross;
  
   // if the number of hours worked is over REG_HRS
      // overtime_hours = hours_worked - REG_HRS
      // regular_hours = REG_HRS;
      // gross = (regular_hours * payrate) + (overtime_hours * OVERTIME)
   // else
      // gross = (hours_worked * payrate)
     
     
   // return the gross to the calling function
         
}
  

/**********************************************************
function: calc_deducts

parameters:(value parameters)
             fwh_percentage
             dependents
             gross_pay
            
             (reference parameters)
             fwh_amount
             insurance_amount
             fica_amount
             deduction_total
***********************************************************/

void calc_deducts()
{
// calculate the fwh_amount by multiplying the gross pay by (fwh_percentage divided by 100)

// if dependents > MAX_DEPENDENTS
    // insurance_amount is (dependents - MAX_DEPENDENTS) * COST_PER_ADD
// else
     // insurance_amount is zero
    
// fica_amount is gross_pay times FICA times .01

// deduction_total is all deductions added together
    
}
  
  
/*******************************************************
   fuction: print_paystub
  
   parameters: (value)
               ssn
               hours_worked
               gross_pay
               fwh_amount
               insurance_amount
               fica_amount
               net_pay
  
               (reference)
               outfile
********************************************************/

void print_paystub()
{
     // output statements for the paystub
}

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 (Here is an File input data will be (in this order): SSN, Pavrate, FHW%, number of dependents, and hours worked. example of what your input file should look like.) 123456789 234567890 345678901 456789012 567890123 8.50 22.3 4 9.22 25.4 2 6.92 19.35 7.53 16.5 1 9.92 24.6 6 40 38 40 47 File output will be a paystub similar to the one below 10/31/2012 $ CPPCC C++ Computing Co Employee SSN Hours Worked : Gross Pay FWH Insurance\' FICA Net Pay: Requirements: 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() get_input() calc_gross() calc_ deducts() print paystub() call all functions and loop until EOF read all inputs pass necessary parameters and return gross pay calculate all deductions pass necessary parameters and output a paystub which contains all the information listed in the paystub sample above Constants to Define: FICA OVERTIME REG HRS MAX DEPENDENTS 2the maximum number of dependents covered by normal insurance COST_PER_ADD 4.75 this is percentage to deduct for social security 1.5 // the amount to multiply overtime hours by 40.0 the number of hours required to work before getting overtime pay 12.00 f 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();
}

Has to be done in c++. // include files #include #include #include #include using namespace std; // declare constants here const double FICA = 4.75; const doubl
Has to be done in c++. // include files #include #include #include #include using namespace std; // declare constants here const double FICA = 4.75; const doubl
Has to be done in c++. // include files #include #include #include #include using namespace std; // declare constants here const double FICA = 4.75; const doubl
Has to be done in c++. // include files #include #include #include #include using namespace std; // declare constants here const double FICA = 4.75; const doubl
Has to be done in c++. // include files #include #include #include #include using namespace std; // declare constants here const double FICA = 4.75; const doubl

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site