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

//     

// Name: Employee Payroll Program

// Description:Employee Payroll Program

http://www.mbnet.mb.ca/~neca/c_source.htm

// By: Found on the World Wide Web

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

//     

#include  /* library files */

#include 

#include 

#include 

#include  

/*declares these as functions with no arguments*/

void employee(void); 

void menu(void);

void list(void);

void check(void);

void add(void);

void add2(void);

void clear(void);

void print(void);

void quit(void);

void addemp(void);

void logo(void);

/*declares these as functions with integer variable type assigned to r' and hw'*/

void calc_gross(float r, float hw); 

/*declares these as functions with integer variable type assigned to h' and a'*/

void calc_deduct(float h, float a); 

void calc_net(void);

/*maximum size of the array*/

#define MAXEMPLOYED 20

/*maximum characters in name field*/

#define MAXNAME 30 

struct empdata{/* these elements declared in the array*/

/* empname declared as char(acter)*/

 char empname[MAXNAME]; 

/* age declared as int(eger)*/

 int age;

/* rate as float variable type*/

 float rate; 

/* hours as float variable type*/

 float hours;

};

/*records is the name of working file pointer*/

FILE * records;

/* initializes the size of the array*/

struct empdata data[MAXEMPLOYED];

/*SIZE is the size of array empdata*/

size = sizeof(struct empdata); 

/* initializes integers to be used thruogh out the pragram (global)*/

int count = 0, base = 0,row; 

int i; 

/* initializes char(acter) ch as a global variable/*

char ch;

/* for cursor properties*/

short oldcursor, newcursor; 

unsigned char start, end;

char buffer[80];

/* calculation variables initalized as floating point*/

float gross, cpp, uic, tax,net; 

float reg_hours, ot_hours;

float reg_pay, ot_pay;sorry

no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !!

/*******************************Main Module**********************************/

/* Removes cursor from screen for duration of program, displays to the */

/* screen the title 'page', user is instructed to 'press a key' which ends */

/* this function and begins the program at the 'menu' module . */

/* this module will not be called again.*/

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

int main(void)

    { 

    /* clears the screen to the display the following*/

    _clearscreen(_GCLEARSCREEN);

    /* removes cursor from the screen*/

    _displaycursor(_GCURSOROFF);

    /* positions text to row, column*/

    _settextposition(3,5); 

    printf(" *********************************************************************");

    _settextposition(4,5);

    printf(" *********************************************************************"); /* printf statements display text to screen*/

    _settextposition(6,31);

    printf("PROGRAMMING PROJECT");

    _settextposition(7,33);

    printf(" C LANGUAGE");

    _settextposition(8,28);

    printf("************************");

    _settextposition(9,28);

    printf("A B C MANUFACTURING INC.");

    _settextposition(10,28);

    printf("************************");

    _settextposition(11,30);

    printf("DESIGNED AND CREATED");

    _settextposition(12,38);

    printf("BY");

    _settextposition(13,34);

    printf("STEVEN POE");

    _settextposition(14,33);

    printf("C.D.I. COLLEGE");

    _settextposition(15,31);

    printf("WINNIPEG, MANITOBA");

    _settextposition(16,33);

    printf("INSTRUCTED BY");

    _settextposition(17,32);

    printf("RICHARD LOEWEN");

    _settextposition(18,33);

    printf("NOVEMBER 1996");

    _settextposition(19,5);

    printf(" *********************************************************************");

    _settextposition(20,5);

    printf(" *********************************************************************");

    _settextposition(23,27);

    printf("TO continue PRESS ANY KEY");

    /* clears the input buffer for clean input*/

    fflush(stdin); 

    /* gets response from user*/

    ch=getch(); 

    /* on getting keystroke, calls menu 'function' */

    menu();

}

/***************************Menu Module *************************************/

/*This is the beginning of the program. Access to all functions Add, List, */

/* Print and Exit are done thru here. User is prompted to select a function */

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

void menu(void)

    { /* beginning of function */

     _clearscreen(_GCLEARSCREEN);

    /* calls logo function which is 'header'*/

     logo();

    /* which is company name and department*/

     _settextposition(10,37); 

     printf("MENU");

     _settextposition(12,25);

     printf("1.- LIST employee records");

     _settextposition(13,25);

     printf("2.- ADD employee records");

     _settextposition(14,25);

     printf("3.- PRINT payroll report");

     _settextposition(15,25);

     printf("4.- QUIT");

     _settextposition(18,12);

     printf("SELECT THE NUMBER PRECEEDING FUNCTION YOU WISH TO ACCESS");

     fflush(stdin);

    while((ch = getch()) != EOF)

        { 

         if (ch == '\n' || ch == ' ' || ch == '\t')

         continue;

        /* these statements will not allow anything other than numerals '1 thru 4' to be selected*/

        if(ch >= '1' || ch <= '4') 

            {

              switch(ch)

              {/* goes to list function*/

              case '1': list(); 

            /* break ends switch */

              break; 

            /* goes to add function*/

              case '2': add(); 

              break; 

            /* goes to print function*/

              case '3': print();

              break;

            /* goes to exit program function*/

              case '4': quit();

              break;

            /* end of switch */

              }

            /* end of if statement */

        } 

    } /* end of while loop */

}/* end of function */

/**************************Employee Module***********************************/

/* this module is called in the program as a function from various other*/

/* modules. this 'function' displays to the screen company name and input*/

/* headings.*/

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

void employee(void)

    { _settextposition(2,30);

    printf("ABC MANUFACTURING");

    _settextposition(3,29);

    printf("WEEKLY PAYROLL REPORT");

    _settextposition(5,7);

    printf("NAME\n");

    printf("RATEHOURS GROSSCPPUICTAX NET PAY\n" );

    printf(" PAY\n");

    printf(" ********************************************************************\n");

}

/*****************************Logo Module************************************/

/* this module is called as a function from other modules. It displays the */

/* company name to the top of the screen. */

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

void logo(void)

    { /* beginning of function */

    _settextposition(3,30);

    printf("ABC MANUFACTURING INC");

    _settextposition(4,31);

    printf("PAYROLL DEPARTMENT");

    _settextposition(5,6);

    printf("********************************************************************** ");

} /* end of function */

/***************************Addemp Module************************************/

/* Called as a function from the 'Add2' module this module places fields for*/

/* input to the screen. */

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

void addemp(void)

    { /*beginning of function */

    _settextposition(1,29);

    printf("ADD EMPLOYEE TO PAYROLL");

    _settextposition(9,6);

    printf("**********************************************************************");

    _settextposition(11,8);

    printf("NAME:");

    _settextposition(13,8);

    printf("AGE:");

    _settextposition(15,8);

    printf("RATE:");

    _settextposition(17,8);

    printf("HOURS:");

}

/**********************************List Module*******************************/

/* this module lists to the screen data stored in 'employee.lst'. Before*/

/* displaying to screen, this module call functions to perform calculations */

/* for payroll hours, rate, deductions and finally net pay. */

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

void list(void)

/*beginning of module */

    { 

    fflush(stdin);

    /*initialize base (referance to current record working with) to 0*/

    base = 0; 

    /* intialize row (when called) to row #9 */

    row = 9;

    /* insures a clear screen*/

    _clearscreen(_GCLEARSCREEN); 

    /* the following opens employee.lst file if it exists, if file does not exist on disc or if no disc etc., error message is displayed*/

    if((records = fopen("a:\employee.lst","rb")) == NULL)

        {

        _clearscreen(_GCLEARSCREEN);

        _settextposition(10,34);

        printf("FILE NOT FOUND",stderr);

        _settextposition(13,23);

        printf("PRESS ANY KEY TO return TO THE MENU");sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !!

        getch();

        _clearscreen(_GCLEARSCREEN);

        menu();

    }

    check();

      if(count == 0)

          {

          _clearscreen(_GCLEARSCREEN);

          _settextposition(10, 25);

          printf("THERE ARE NO RECORDS IN FILE");

          _settextposition(12, 23);

          printf("PRESS ANY KEY TO return TO MENU");

          ch=getch();

          menu();

          }

        records = fopen("a:\employee.lst","rb"); 

        /* calls employee function*/

        employee();

          sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !!

        /* do this while the count of MAXEMPLOYED is less than declared size and*/

        /* reading file, size of the file, 1 file at a time, current record.While*/

        /* this is true continue with statements within block. */

        while(count < MAXEMPLOYED && fread(&data[base], size, 1, records) == 1)

            { 

            _settextposition(row,8);

            /* put string to preset position, empname*/

            puts(data[base].empname); 

            /* increment row by 1*/ 

            row++;   

            /* calls gross calcuation function*/

            calc_gross(data[base].rate, data[base].hours); 

            /* calls deduct calculation function*/

            calc_deduct(data[base].hours, data[base].age); 

            /*calls net pay calculation function*/

            calc_net();  

            _settextposition(row,12);

            /* display calculated rate and hours to the screen*/

            printf("%-2.2f\t%-2.2f\t",(data[base].rate),(data[base].hours));

            /*display all other deduction and net pay calculations to the screen*/

            printf(" %-4.2f\t %-2.2f\t %-2.2f\t%-3.2f\t %-4.2f",gross, cpp, uic, tax, net); 

            /*increment file postion by 1*/

            base++; 

            /*"row position by 1 */ 

            row++;

            /* by way of remainder division of records, show 5 records*/

            if( base %5 == 0)

                {

                _settextposition(24,25);

                puts("PRESS ANY KEY TO SHOW MORE RECORDS"); 

                fflush(stdin);

                /* wait for keystroke to continue*/

                ch=getch(); 

                _clearscreen(_GCLEARSCREEN);

                employee(); 

                /* re- initialize row to 9 to show remaining records*/

                row = 9;

                /* end of the if statements */

            } 

            /* end of do while loop */

        }

        row++;

        row++;

        _settextposition(row,27);

        printf("END OF EMPLOYEE PAYROLL FILE");

        row++;

        row++;

        _settextposition(row,25);

        printf("PRESS ANY KEY TO return TO MENU");

        fflush(stdin);

        ch=getch();

        menu();

    } /* List function ends */

    sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !!

    /************************CHECK MODULE****************************************/

    /***********This module checks for number of files on disc*******************/

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

    void check(void)

        {

        records = fopen("a:\employee.lst", "rb");

        rewind(records);

        count = 0;

        while(fread(&data[count], size, 1, records) == 1)

        count++;

        fclose(records);

        return;

    }sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !!

    sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !!

    /**********************************ADD Module********************************/

    /* The add Module calls three functions to perform the add function. Add is also called later as a function. */

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

    sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !!

    void add(void)

        { /* beginning of add main block */

         _clearscreen(_GCLEARSCREEN);

        /* calls logo function */

         logo(); 

        /* calls addemp function */

         addemp();

        /* calls add2 function */

         add2(); 

    }/* end of the Add Module */

    /*********************************Add2 Module********************************/

    /* this module checks for disc and creates employee.lst if it does not exist. At this point writing to file is now possible. */

    */ Prompts user for input, writes to disc and closes file.*/

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

    void add2(void)sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !!

        {/* begins module main block */

        /* assign x the value of 0, as a floating point type */

        float x=0.0; 

        count = 0;

        check();s

        orry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !!

        /* The following statement checks for disc in drive, if it is a file named*/

        /* Employee.lst is created (opened for read + write in binary mode*/

        if((records = fopen("a:\Employee.lst","a+b")) == NULL)

            { /* beginning of 1st if statements*/ 

            _clearscreen(_GCLEARSCREEN);

            /* if no disc the following is presented to the screen. */

            _settextposition(14,13);

            printf("CANNOT READ OR WRITE TO DISC OR DEVICE NOT FUNCTIONING");

            _settextposition(15,8);

            printf("PLEASE CHECK DISC for WRITE PROTECT, NO DISC OR DRIVE MALFUNCTION");

            _settextposition(16,28);

            printf("PLEASE CORRECT AND RETRY");

            _settextposition(17,23);

            printf("PRESS ANY KEY TO return TO THE MENU"); 

            /* wait for keystroke */

            getch(); 

            _clearscreen(_GCLEARSCREEN);

            /* menu is called go to menu module */

            menu();

        }

        if(count >= MAXEMPLOYED)sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !!

        /* error message is displayed if amount of files is more than declared size of MAXRECORDS */

            { /* begin 2nd if block */

             _settextposition(6,19);

             fputs("RECORDS CAN NO LONGER BE ADDED TO this FILE",stderr);

             _settextposition(7,20);

             fputs("SEE ADMINISTRATOR for FURTHER INSTRUCTIONS",stderr);

             _settextposition(8,24);

             fputs("PRESS ANY KEY TO return TO THE MENU",stderr);

            /* get keystroke from user */

             getch();

             _clearscreen(_GCLEARSCREEN);

            /* call menu module */

             menu(); 

            /* end of 2nd if block */

        }

        sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !!

        _settextposition(7,8);sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !!

        puts("TO ADD EMPLOYEES TO PAYROLL FILE PRESS "); 

        /* clear input */

        fflush(stdin);

        /* wait for keystroke */

        ch= getch(); 

        /* if keystroke is 'enter', continue */

        if(ch == 13) 

            { /* begin input if block */

             _settextposition(7,8);

             puts("ENTER new EMPLOYEE'S NAME; FIRST, LAST, THEN PRESS ");

             fflush(stdin);sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !!

             _settextposition(11,15);

            /* do while the amount of records in array is less than MAXRECORDS-get input from user (name)*/

             while(count < MAXEMPLOYED && gets(data[count].empname) != NULL && data[count].empname[0] !='\0')

                { /* begin 1st while loop */

                 _settextposition(7,8);

                 printf(" ");

                 fflush(stdin);

                  _settextposition(7,8);

                  puts("Please enter AGE of employee");

                  _settextposition(13,15);sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !!

                  scanf("%d", &data[count].age);

                  _settextposition(23,15);

                /* clears text */

                  printf("");

                  _settextposition(7,8);

                /* clears text */

                  printf("");

                  _settextposition(7,8);

                  puts("Please enter hourly RATE of employee");

                  _settextposition(15,15);

                  scanf("%f", &data[count].rate);

                  _settextposition(7,8);

                  printf("");ry no !!

                  _settextposition(23,15);

                  printf("");/* clears text */

                sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !sorry no !!

                  _settextposition(7,8);

                  puts("Please enter total HOURS worked");

                  _settextposition(17,15);

                  scanf("%f", &data[count].hours);

                  clear();

                /* finds the end of the file */

                  fseek(records, 0L, SEEK_END); 

                /* writes to the file employee.lst all data inputed to array elements */

                  fwrite(&data[count],size,1,records);

                /* increment file position by 1 */

                  count++; 

                  _settextposition(7,8);

                /* clears text */

                  printf(" "); 

                  _settextposition(23,15);

                /* clears text */

                  printf(" "); 

                 _settextposition(7,8);

                  printf("TO ADD ANOTHER EMPLOYEE PRESS ENTER");

                 _settextposition(24,35);

                 printf("RETURN TO MENU");

                 _settextposition(25,38);

                 printf("PRESS M"); /* clears input */This will not compile!!!

                 fflush(stdin); 

                /* get keystroke from user */

                 ch=getch();

                /* clears text */

                 _settextposition(7,8);

                 printf(" ");

                /* if key selected is 'm' or 'M': */

                  if(ch == 77 || ch == 109) 

                /* begin if statements if true */ 

                    { 

                    /* close the file */

                     fclose(records); 

                    /* calls clear function */

                     clear();

                    /* calls the menu */

                     menu(); 

                    /*end if statements and returns control to while loop */

                } 

                if(count >= MAXEMPLOYED)

                /* error message is displayed if amount of files is more than declared size of MAXRECORDS */

                    { /* begin 2nd if block */

                     _settextposition(24,35);

                     printf("");

                     _settextposition(25,38);

                     printf("");

                     _settextposition(6,19);

                     fputs("RECORDS CAN NO LONGER BE ADDED TO this FILE",stderr);

                     _settextposition(7,20);

                     fputs("SEE ADMINISTRATOR for FURTHER INSTRUCTIONS",stderr);

                     _settextposition(8,24);

                     fputs("PRESS ANY KEY TO return TO THE MENU",stderr);

                    /* get keystroke from user */

                     getch();

                     _clearscreen(_GCLEARSCREEN); 

                    /* call menu module */

                     menu();

                    /* end of 2nd if block */

                }

                /* calls clear function to erase fields */

                  clear();

                  _settextposition(24,35);

                  printf(" ");

                  _settextposition(25,38);

                  printf(" ");!le!!

                  _settextposition(7,8);

                  printf("NEXT EMPLOYEE'S NAME; FIRST, LAST");/* re-positions text to start at first field again */

                  _settextposition(11,15); 

            }/* end 1st while loop */

            this will not compile!!This will not compile!!This will not compile!!This will not compile!!This will not compile!!

             _clearscreen(_GCLEARSCREEN);

             _settextposition(10,29);

            /* error message from not entering name in first field */

             printf("YOU MUST ENTER A NAME");

            /* clears input */  

             fflush(stdin);  

            /* positions cursor to name field to erase erroneous characters */

             _settextposition(11,15);

            /* clears text */

             printf(""); 

             _settextposition(12,27);

             printf("PRESS ANY KEY TO CONTINUE");

            /* gets any keystroke */

            ch=getch();

            /* calls add function */

             add();

            /* ends (input) if block */

        } 

        /* do this if condition is false (not pressing enter) */

        else

            {/* begin else statements */

            _clearscreen(_GCLEARSCREEN);

            _settextposition(10,25);

            puts("YOU MUST PRESS ENTER TO CONTINUE");

             _settextposition(12,28);

             printf("PRESS ANY KEY TO return TO");

             _settextposition(13,30);

             printf("ADD EMPLOYEE FUNCTION");

            ch=getch();

              add();

        } 

    } /* end of add2 function*/

    

    /**********************************Clear Module******************************/

    /* Clear erases text in fields for the next employee data to be entered.*/

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

    void clear(void)

        {

        _settextposition(11,15);

        printf("");

        _settextposition(13,15);

        printf(" ");

        _settextposition(15,15);

        printf("");

        _settextposition(17,15);

        printf("");

    }

    /********************************Print Module********************************/

    /*********Print module sends data from employee.lst to the printer***********/

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

    void print(void)

        { /* Begins function block */

        /* initialize base to zero */

        base = 0; 

        check();

        _clearscreen(_GCLEARSCREEN);/* calls logo function */

        logo();

        _settextposition(15,24);

        puts("PRINTING SELECTED PAYROLL REPORT");

        /* the following statement checks for a:\employee.lst on disc. if file is not on disc or no disc, continues into block statements */

        if((records = fopen("a:\employee.lst","rb")) == NULL)

            {/* begins if block statements */

            _clearscreen(_GCLEARSCREEN);

            _settextposition(10,32);

            printf("FILE NOT FOUND",stderr);

            _settextposition(13,23);

            printf("PRESS ANY KEY TO return TO THE MENU");

            getch();

            _clearscreen(_GCLEARSCREEN);

            menu();

        }

        /* insures the beginning of the file */

        rewind(records); 

        /* the following checks that the count of records is not more than the declared*/

        /* value of MAXRECORDS and reads 1 file at a time of the array */

        while(count < MAXEMPLOYED && fread(&data[base], size, 1, records) == 1)

            { 

            if(base % 5 == 0)

                { /* begin if statements-if base, using modulas (returns remainder) is equal to 0 */

                /* prints the following at the printer, not to the screen. */

                fputs("\n\t\t\t ABC MANUFACTURING INC\n",stdprn);

                fputs("\t\t\t PAYROLL DEPARTMENT\n\n",stdprn);

                fputs("\t\t WEEKLY PAYROLL REPORT\n\n",stdprn);

                fputs("***************************************************************************\n",stdprn);

                fputs("NAME\n",stdprn);

                fputs(" RATE HOURS GROSSCPPUICTAXNET PAY\n",stdprn);

                fputs(" PAY\n",stdprn);

                fputs("***************************************************************************\n",stdprn);

            } /* ends the 1st if statement then continues to the main body to perform calculations */

            /* calls calc_gross function using input of elements rate and hours */

            calc_gross(data[base].rate, data[base].hours); 

            /* calls calc_ deduct function using input of elements hours and age */

            calc_deduct(data[base].hours, data[base].age); 

            /* calls calc_net */Thi

            calc_net();s will not compile!!This will not compile!!

            /* the following prints the calculated amounts to the respective columns */

            /* prints character string, left-justified, 30 characters from 1st element .name */

            fprintf(stdprn,"%-30s\n",(data[base].empname)); 

            /* prints float value, left-justified with two decimal places */

            fprintf(stdprn, " %-2.2f %-2.2f ",(data[base].rate),(data[base].hours));

            fprintf(stdprn, " %-4.2f %-2.2f %-2.2f %-3.2f %-4.2f\n",gross, cpp, uic, tax, net);T

            his /* increment base position */

            base++; 

            if( base %5 == 0)This will not compile!!

            /* form feed new page */

             fprintf(stdprn,"\f"); 

        } /* end of while loop */

        /* close file */

        fclose(records);This will not compile!!

        _settextposition(25,25);

        printf("RETURN TO MENU - PRESS ANY KEY");

        fflush(stdin);

        ch=getch();

        menu();

    }/* end of Print function */

    /*********************************Quit Module********************************/

    /**************offers user last choice before exiting***********************/

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

    void quit(void)

        { /* begin Quit function */This will not compile!!

         _clearscreen(_GCLEARSCREEN);

        _settextposition(10,28);

        printf("MAIN MENU-Press any key");

         _settextposition(15,32);This will not compile!!

        printf("EXIT- Press X");

         fflush(stdin);

         ch = getch();

         if(ch == 120 || ch == 88)This will not compile!!

          { 

         _settextposition(0,0);

         _clearscreen( _GCLEARSCREEN);

         /* replaces cursor on exit of program */

         _displaycursor( _GCURSORON ); 

          exit(1);

          }/* end if statements */

        /* calls menu function */

          menu();

    }

    /*****************************Calc_gross Function****************************/

    /********** Performs the calculations of gross pay and hours worked**********/

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

    void calc_gross(float r, float hw)

        { /* begins calc_gross function */

        /* intialize variables to 0 */

        reg_hours = 0;

        ot_hours = 0;

        reg_pay = 0;

        ot_pay = 0;

        gross = 0; 

        

        /* assigns reg_hours to variable hw */

         reg_hours = hw; 

         /* if reg_hours (hw) is more than 40 hrs */

         if(hw > 40) 

            { 

            /* ot_hours is the result of total hours - 40 */

             ot_hours = (hw - 40);

            /* reg_hours given the value of 40 , integer is required to perform calculations */

             reg_hours = 40;

            /* end of if statements, contiue with main block */

        } 

        

        /* assigns reg_pay to value of r multiplied by value of reg_hours */

        reg_pay = r * reg_hours;

        /* assigns ot_hours to value of r multiplied by 1.5 */

        ot_hours = r * 1.5;

        /* assign value of calculated ot_hours to ot_pay variable*/

        ot-pay = ot_hours;

        /* assigns gross to sum of reg_pay and ot_pay */

        gross = reg_pay + ot_pay; 

        /* end of calc_gross module */

    } 

    /********************************Calc_deduct Module**************************/

    /*************** Calculates deductions for cpp, uic and taxes****************/

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

    void calc_deduct(float h, float a) 

        { /* block starts */

        /*if age is greater than 18 and age is less than 70*/

        if(a > 18 && a < 70)

         cpp = gross * .023;

        else

         cpp = 0;

        /*if gross is more than 272 or hours is more than or equals 30*/

        if (gross > 272 || h>= 30) 

         uic = gross * .0225;

        else

         uic= 0;

        if (gross < 200)

         tax = gross * .18;

        if (gross >= 200 && gross < 300)

         tax = gross * .21; sorry no !sorry no !sorry no !sorry no !sorryThis will not compile!! no !sorry no !sorry no !sorry no !sorry no !

        if (gross >= 300 && gross < 400)

         tax = gross * .25;

        if (gross >= 300 && gross < 500)

         tax = gross * .29;This will not compile!!This will not compile!!

        if (gross >= 500)

         tax = gross * .33;

    } /* block ends */

    /*************************Calc_net Module************************************/

    /*********************** calculates net pay *********************************/

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

    void calc_net(void)

        {

        net = gross - cpp - uic - tax;This will not compile!!This will not compile!!

    }