# Thread: Help! User defined functions

1. ## Help! User defined functions

Ok, the problem is I need to calculate my net pay after taxes.

I want to have a user defined function which calculates the math portion and displays the results in the main function. These are the parts of the problem:
Medical plan deduction = \$75.65

Social security tax rate = 7.51%

Federal income tax rate = 16.5%

State income tax rate = 4.5%

United Fund deduction = \$15.00

The medical deduction must be subtracted from the gross pay before the tax amounts are computed. Then the taxes should be computed and subtracted from the gross. As each one is computed, I want to print the amount. Finally, I need to subtract the United Fund contribution and return the remaining amount.
----------------------------------------------
This is what I have thus far:
Code:
```#include <stdio.h>

float netpay()
int main(void)
{
int grosspay;
printf("This program calculates gross pay./n");
printf("Please enter the gross pay: ");
scanf("%d", &grosspay);
return 0;

}```
Please be gental I'm still very much a C newbie in need of help. I would appreciate any constructive help. Thanks.

-Ricky

2. ## What should I do now?

Someone? Anyone?

3. First, don't post again asking for a response. When somebody sees your question who can help, they'll respond to it. Just be patient, they sit awhile sometimes. Second, you aren't posing a question. What do you need help with? If you just need help with how to write your program, post up your ideas first. If you have specific code examples, post those too. We want to help you. We don't want to just do your work for you.

4. >>float netpay()
... should probably be:
>>float netpay(int grosspay)

So, code the function like this:
Code:
```float netpay(int grosspay)
{
float netpay;

/* Do maths here */

return (netpay);
}```