Working Hours | 2002-06-01

Portfolio » Application Programming

 
// Written by [email protected]
#include<iostream.h>

double calcsstax(int worked_hrs,int ot_hrs);
double calcfedtax(int worked_hrs,int ot_hrs);
int calcex_ins(int num_dep);

int main()
{
      char ans;
      const double payrt=16.78,sstxrt=.06,fedtxrt=.14,sttxrt=.05;
      double grspay,sttax,sstax,fedtax,net_inc;
      const int unionds = 10;
      int worked_hrs,ot_hrs,ex_ins,num_dep;

    do
    {
         cout<<"\n\nEnter the number of hours worked in a week: ";
         cin>>worked_hrs;
         cout<<"Enter the number of dependents: ";
         cin>>num_dep;

             if (worked_hrs > 40)
            {
                 ot_hrs = worked_hrs - 40;
                 *********************        
          }
         grspay = worked_hrs * payrt+ot_hrs * 1.5 * payrt;
         sstax = calcsstax(worked_hrs,ot_hrs);
         fedtax = calcfedtax(worked_hrs,ot_hrs);
         sttax = grspay * sttxrt;
         ex_ins = calcex_ins(num_dep);

         net_inc = grspay-sstax-fedtax-sttax-unionds-ex_ins;

         cout<<"Net income is " <<net_inc;
         cout<<"\n\nDo u want another caculation?\n"
             <<"Press y for yes, n for no,\n"
         <<"and then press return: ";
         cin>>ans;
     }while (ans=='y' || ans =='Y');
     cout<<"Good-Bye\n";
     return 0;
}



double calcsstax(int worked_hrs,int ot_hrs)
{
     const double payrt = 16.78,sstxrt = .06;
     double grpay,sstax;

     grpay = ***************
     sstax = grpay * sstxrt;
     return sstax;
}



double calcfedtax(int worked_hrs,int ot_hrs)
{
     const double payrt = 16.78,fedtxrt = .14;
     double grpay,fedtax;

     grpay = worked_hrs * payrt + ot_hrs * 1.5 *****************;
     fedtax = grpay * fedtxrt;
     return fedtax;
}


int calcex_ins(int num_dep)
{
     int ex_ins;

    if (num_dep >= 3)
         ex_ins = 35;
    else
         ex_ins = 0;
     return ex_ins;
}

*** indicated that some partial code has been removed