Thread: Payroll

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    Payroll


    can someone help me,actually i do not understand this question at all.an in new here..i dont know how to start it.Hope someone can help me


    1.Prepare a payroll earning statement for the sales force at the Arctic Ice Company. All Arcticís employees are on the straight commission basis of 12.5% of sales. Each month, they also receive a bonus that varies depending on the profit for the month and their length of service. The sales manager calculates the bonus separately and enters it with the salespersonís total sale for a month. Your program is also to calculate the withholding taxes and retirement for the month based on the following rates.

    a. 25% Federal withholding.
    b. 10% State withholding.
    c. 8% retirement plan.

    Use test data in Table 6.2 to test the program.

    Salesperson Sales Bonus
    1 53, 500 425
    2 41, 300 300
    3 56, 800 350
    4 36, 200 175
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,387
    Rep Power
    1871
    A very minimal start point
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    int main ( ) {
        char buff[BUFSIZ];
        FILE *fp = fopen("foo.txt","r");
        while ( fgets( buff, BUFSIZ, fp ) != NULL ) {
            int salesPersonID;
            if ( sscanf(buff,"%d",&salesPersonID) == 1 ) {
                printf("Found ID=%d\n", salesPersonID );
            }
        }
        fclose(fp);
        return 0;    
    }
    
    $ gcc bar.c
    $ ./a.out 
    Found ID=1
    Found ID=2
    Found ID=3
    Found ID=4
    $ cat foo.txt
    1 53, 500 425
    2 41, 300 300
    3 56, 800 350
    4 36, 200 175
    Over to you to do
    - enhance the sscanf to extract all the other data
    - do all the calculations
    - print the correct results
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    Smile


    i think i got an idea now,tq salem. :)

IMN logo majestic logo threadwatch logo seochat tools logo