my function was working all fine and dandy but boring until my friend separated the function for me which we are suppose(required by teacher) to do and now my program stops after i enter the first and last name ( i was the one that added multiple return 0;) i am running out of time this is due friday and i have to draw flow charts for these please help me

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>

int main()
{
    printf("\t//*****************St.Jago High School******************\\ \n\n");
    printf("\t------------Courtney Athlone St.Michael Reid---------------\n\n");
      printf("\t^^^^^^^^^Computer Science IA-Pay Roll System^^^^^^^^^\n\n");

    char fname[50];
    char lname[20];

    printf("Enter the employee's First Name:\n");
    scanf("%s",&fname[50]);

    printf("Enter the employee's Last Name:\n");
    scanf("%s",&lname[20]);

    return 1;
}
int add_hours()
{
printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");


    int hours;
    int mo, tu, we, th, fr;


    printf("Enter daily hours for Monday:\n");
    scanf("%d",&mo);

    printf("Enter daily hours for Tuesday:\n");
    scanf("%d",&tu);

    printf("Enter daily hours for Wednesday:\n");
    scanf("%d",&we);

    printf("Enter daily hours for Thursday:\n");
    scanf("%d",&th);

    printf("Enter daily hours for Friday:\n");
    scanf("%d",&fr);
    hours=mo+tu+we+th+fr;
    printf("\nThe weekly hours are:%d\n",hours);

    printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
    printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");

    return 2;

}
int salary_select()
{
    int education_tax;
    int NIS_tax;
    int NHT_tax;
    int medical_dental;

    int hours;
    int salary_deduct=0;salary_deduct>20;salary_deduct++;
    int normal_pay;
    int over_time; /*Overtime pay increases the pay rate from $20 to $25*/
    int bonus=0;bonus>1;bonus++; /* Adds $3000 to workers going over 70 hours*/

    normal_pay=hours*20;
    over_time=(hours-60)*40+normal_pay;
    bonus=over_time+3000;
    salary_deduct=hours*20-hours*10;

    if(hours<=40)
    printf("\nThe employee is slacking and salary will be deducted!\nThe gross pay is:$%d dollars\n",salary_deduct);
    else if(hours<=60)
    printf("\nThe employee will get normal pay\nThe gross pay is:$%d dollars\n",normal_pay);
    else if(hours<=70)
    printf("\nThe employee is working over time and will get overtime pay\nThe gross pay is:$%d dollars\n",over_time);
    else
    printf("\nTHE EMPLOYEE IS WORKING EXTREMELY HARD AND WILL GET A BONUS ON HIS PAY!\nThe gross pay is:$%d\n",bonus);

    printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
    printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");

    return 3;

}
int tax()
{
    int normal_pay;
    int over_time; /*Overtime pay increases the pay rate from $20 to $25*/
    int bonus=0;bonus>1;bonus++; /* Adds $3000 to workers going over 70 hours*/
    int salary_deduct=0;salary_deduct>20;salary_deduct++;
    int hours;
    int education_tax;
    int NIS_tax;
    int NHT_tax;
    int medical_dental;

    education_tax=hours*20*.06;
    NHT_tax=hours*20*.1;
    medical_dental=hours*20*.05;
    NIS_tax=hours*20*.05;

    printf("Education tax of %6:$-%d\n",education_tax);

    printf("NHT tax of %10:$-%d\n",NHT_tax);

    printf("NIS tax of %5:$-%d\n",NIS_tax);

    printf("Medical/dental of %5:$-%d\n",medical_dental);

    printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
    printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");

    return 4;

}
int ntpay()
{
    int normal_pay;
    int over_time; /*Overtime pay increases the pay rate from $20 to $25*/
    int bonus=0;bonus>1;bonus++; /* Adds $3000 to workers going over 70 hours*/
    int education_tax;
    int NIS_tax;
    int NHT_tax;
    int medical_dental;
    int salary_deduct=0;salary_deduct>20;salary_deduct++;
    int hours;
    int netpay;
    int netpay1;
    int netpay2;
    int netpay3;

    netpay=salary_deduct-(NHT_tax+education_tax+NIS_tax+medical_dental);
    netpay1=normal_pay-(NHT_tax+education_tax+NIS_tax+medical_dental);
    netpay2=over_time-(NHT_tax+education_tax+NIS_tax+medical_dental);
    netpay3=bonus-(NHT_tax+education_tax+NIS_tax+medical_dental);

   if(hours<=40)
    printf("The net pay is:$%d\n",netpay);
    else if(hours<=60)
    printf("The net pay is:$%d\n",netpay1);
    else if(hours<=70)
    printf("The net pay is:$%d\n",netpay2);
    else
    printf("The net pay is:$%d\n",netpay3);
printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");

return 5;
}

Recommended Answers

All 11 Replies

Could you please use code tags to post your program...

This is kind of what I meant by posting your code with tags, notice the indentation...You have so many problems with this code its hard to know where to begin...

A hint - when you write programs compile often and when you have errors or warnings fix them before you move on...

This is a no no..Number one its syntactically incorrect and two its just hard to read.

int salary_deduct=0;salary_deduct>20;salary_deduct++;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	char fname[50];
	char lname[20];

	printf("\t//*****************St.Jago High School******************\\ \n\n");
	printf("\t------------Courtney Athlone St.Michael Reid---------------\n\n");
	printf("\t^^^^^^^^^Computer Science IA-Pay Roll System^^^^^^^^^\n\n");

	printf("Enter the employee's First Name:\n");
	scanf("%s",&fname[50]);

	printf("Enter the employee's Last Name:\n");
	scanf("%s",&lname[20]);

	return 1;
}

int add_hours()
{
	int hours;
	int mo, tu, we, th, fr;

	printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
	printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");


	printf("Enter daily hours for Monday:\n");
	scanf("%d",&mo);

	printf("Enter daily hours for Tuesday:\n");
	scanf("%d",&tu);

	printf("Enter daily hours for Wednesday:\n");
	scanf("%d",&we);

	printf("Enter daily hours for Thursday:\n");
	scanf("%d",&th);

	printf("Enter daily hours for Friday:\n");
	scanf("%d",&fr);
	hours=mo+tu+we+th+fr;
	printf("\nThe weekly hours are:%d\n",hours);

	printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
	printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");

	return 2;
}
int salary_select()
{
	int education_tax;
	int NIS_tax;
	int NHT_tax;
	int medical_dental;

	int hours;
	int salary_deduct = 0;
	int normal_pay;
	int over_time; /*Overtime pay increases the pay rate from $20 to $25*/
	int bonus = 0; /* Adds $3000 to workers going over 70 hours*/

	normal_pay = hours * 20;
	over_time = (hours - 60) * 40 + normal_pay;
	bonus = over_time + 3000;
	salary_deduct = hours * 20 - hours * 10;

	if(hours <= 40)
		printf("\nThe employee is slacking and salary will be deducted!\nThe gross pay is%d dollars\n",salary_deduct);
	else if(hours <= 60)
		printf("\nThe employee will get normal pay\nThe gross pay is%d dollars\n",normal_pay);
	else if(hours <= 70)
		printf("\nThe employee is working over time and will get overtime pay\nThe gross pay is%d dollars\n",over_time);
	else
		printf("\nTHE EMPLOYEE IS WORKING EXTREMELY HARD AND WILL GET A BONUS ON HIS PAY!\nThe gross pay is%d\n",bonus);

	printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
	printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");

	return 3;
}
int tax()
{
	int normal_pay;
	int over_time; /*Overtime pay increases the pay rate from $20 to $25*/
	int bonus = 0; /* Adds $3000 to workers going over 70 hours*/
	int salary_deduct = 0;
	int hours;
	int education_tax;
	int NIS_tax;
	int NHT_tax;
	int medical_dental;

	education_tax = hours * 20 * .06;
	NHT_tax = hours * 20 * .1;
	medical_dental= hours * 20 * .05;
	NIS_tax = hours * 20 * .05;

	printf("Education tax of %d\n",education_tax);

	printf("NHT tax of %d\n",NHT_tax);

	printf("NIS tax of %d\n",NIS_tax);

	printf("Medical/dental of %d\n",medical_dental);

	printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
	printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");

	return 4;
}
int ntpay()
{
	int normal_pay;
	int over_time; /*Overtime pay increases the pay rate from $20 to $25*/
	int bonus = 0; /* Adds $3000 to workers going over 70 hours*/
	int education_tax;
	int NIS_tax;
	int NHT_tax;
	int medical_dental;
	int salary_deduct = 0;
	int hours;
	int netpay;
	int netpay1;
	int netpay2;
	int netpay3;

	netpay = salary_deduct - (NHT_tax + education_tax + NIS_tax + medical_dental);
	netpay1 = normal_pay - (NHT_tax + education_tax + NIS_tax + medical_dental);
	netpay2 = over_time - (NHT_tax + education_tax + NIS_tax + medical_dental);
	netpay3 = bonus - (NHT_tax + education_tax + NIS_tax + medical_dental);

	if(hours <= 40)
		printf("The net pay is%d\n",netpay);
	else if(hours <= 60)
		printf("The net pay is%d\n",netpay1);
	else if(hours <= 70)
		printf("The net pay is%d\n",netpay2);
	else
		printf("The net pay is%d\n",netpay3);

	printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
	printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");

	return 5;
}

it was working perfectly before my friend separated the function i will send u a working copy now. what i need to do is to separate it into at least 4 functions

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>



int main()
{
    printf("\t//*****************St.Jago High School******************\\ \n\n");
    printf("\t------------Courtney Athlone St.Michael Reid---------------\n\n");
      printf("\t^^^^^^^^^Computer Science IA-Pay Roll System^^^^^^^^^\n\n");

    int hours;
    int mo, tu, we, th, fr;
    int salary_deduct=0;salary_deduct>20;salary_deduct++;
    int normal_pay;
    int over_time; /*Overtime pay increases the pay rate from $20 to $25*/
    char fname[50];
    char lname[20];
    int bonus=0;bonus>1;bonus++; /* Adds $3000 to workers going over 70 hours*/
    int education_tax;
    int NIS_tax;
    int NHT_tax;
    int medical_dental;
    int netpay;
    int netpay1;
    int netpay2;
    int netpay3;




    {

    printf("Enter the employee's First Name:\n");
    scanf("%s",&fname[50]);

    printf("Enter the employee's Last Name:\n");
    scanf("%s",&lname[20]);

    printf("Enter daily hours for Monday:\n");
    scanf("%d",&mo);

    printf("Enter daily hours for Tuesday:\n");
    scanf("%d",&tu);

    printf("Enter daily hours for Wednesday:\n");
    scanf("%d",&we);

    printf("Enter daily hours for Thursday:\n");
    scanf("%d",&th);

    printf("Enter daily hours for Friday:\n");
    scanf("%d",&fr);

    }

    {

    hours=mo+tu+we+th+fr;
    printf("\nThe weekly hours are:%d\n",hours);


    normal_pay=hours*20;
    over_time=(hours-60)*40+normal_pay;
    bonus=over_time+3000;
    salary_deduct=hours*20-hours*10;


    }
{
    if(hours<=40)
    printf("\nThe employee is slacking and salary will be deducted!\nThe gross pay is:$%d dollars\n",salary_deduct);
    else if(hours<=60)
    printf("\nThe employee will get normal pay\nThe gross pay is:$%d dollars\n",normal_pay);
    else if(hours<=70)
    printf("\nThe employee is working over time and will get overtime pay\nThe gross pay is:$%d dollars\n",over_time);
    else
    printf("\nTHE EMPLOYEE IS WORKING EXTREMELY HARD AND WILL GET A BONUS ON HIS PAY!\nThe gross pay is:$%d\n",bonus);
}


{
    education_tax=hours*20*.06;
    printf("Education tax of %6:$-%d\n",education_tax);
    NHT_tax=hours*20*.1;
    printf("NHT tax of %10:$-%d\n",NHT_tax);
    NIS_tax=hours*20*.05;
    printf("NIS tax of %5:$-%d\n",NIS_tax);
    medical_dental=hours*20*.05;
    printf("Medical/dental of %5:$-%d\n",medical_dental);
}
{
    netpay=salary_deduct-(NHT_tax+education_tax+NIS_tax+medical_dental);
    netpay1=normal_pay-(NHT_tax+education_tax+NIS_tax+medical_dental);
    netpay2=over_time-(NHT_tax+education_tax+NIS_tax+medical_dental);
    netpay3=bonus-(NHT_tax+education_tax+NIS_tax+medical_dental);



    if(hours<=40)
    printf("The net pay is:$%d\n",netpay);
    else if(hours<=60)
    printf("The net pay is:$%d\n",netpay1);
    else if(hours<=70)
    printf("The net pay is:$%d\n",netpay2);
    else
    printf("The net pay is:$%d\n",netpay3);
}


    return 0;
}

Without even reading your code..I know this is incorrect

int salary_deduct=0;salary_deduc t> 20;salary_deduct++;
int bonus=0;bonus > 1;bonus++;

The lines salary_deduc t> 20 and bonus > 1 have no effect. Plus when you write code like this its impossible to separate declarations and code.

It should be like below:

int salary_deduct = 0;
int bonus = 0;	

salary_deduct++; 
bonus++;

my function was working all fine and dandy but boring until my friend separated the function for me which we are suppose(required by teacher) to do and now my program stops after i enter the first and last name ( i was the one that added multiple return 0;) i am running out of time this is due friday and i have to draw flow charts for these please help me

Your first problem is you let your friend change your code without knowing what he did. If it's your code, you need to make the changes -- and understand what your changes are. Go back to what was working before your friend tried to help.

Second, the purpose of the flowchart is to design and understand the program needed, then code the program from that design. You don't write the program then make a flowchart to fit. It's much easier starting with the flowchart.

I understand that and all but i am extremely new to c programming and its easier for me to make the flowchart from the code but anyways thats not the point right now i just need to separate the functions into 4 so that i dont have one big function called main and i have to do this by friday a function for adding,selecting the type of pay the employee must get, the tax function, the net pay function and the main function so can u show me how to separate it from the working one that i posted or at least show me to a thread where i can see how to separate functions please it would be utmostlyepiclygenerocioucly appreciated (its a new word)-------------------------^

Figure out 4 parts of the program -- 4 segments of distinct functionality (input, output, etc.)
Copy the code for each section and create a function around it. What data needs to be given to the function that used to be in main() and is now missing? Add those as parameters. Do one at a time and test test test!!

ok im doing it now and this is what i have so far but is it ok for me to take out return 0; and what about the last } where return 0; should have been? please test and run it for me please i have to go sleep now i will try and work as long as i can, i know i'm being a very presumptuous newbie but please help me its due friday and i had to teach my self c for weeks off of google

include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>



int main()
{
    printf("\t//*****************St.Jago High School******************\\ \n\n");
    printf("\t------------Courtney Athlone St.Michael Reid---------------\n\n");
      printf("\t^^^^^^^^^Computer Science IA-Pay Roll System^^^^^^^^^\n\n");

    char fname[50];
    char lname[20];

    printf("Enter the employee's First Name:\n");
    scanf("%s",&fname[50]);

    printf("Enter the employee's Last Name:\n");
    scanf("%s",&lname[20]);
}

int add_hours() 
{
printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");


    int hours;
    int mo, tu, we, th, fr;



    printf("Enter daily hours for Monday:\n");
    scanf("%d",&mo);

    printf("Enter daily hours for Tuesday:\n");
    scanf("%d",&tu);

    printf("Enter daily hours for Wednesday:\n");
    scanf("%d",&we);

    printf("Enter daily hours for Thursday:\n");
    scanf("%d",&th);

    printf("Enter daily hours for Friday:\n");
    scanf("%d",&fr);
    hours=mo+tu+we+th+fr;
    printf("\nThe weekly hours are:%d\n",hours);
    
    printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
    printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");

}

int salary_select;{
    int education_tax;
    int NIS_tax;
    int NHT_tax;
    int medical_dental;

    int hours;
    int salary_deduct=0;salary_deduct>20;salary_deduct++;
    int normal_pay;
    int over_time; /*Overtime pay increases the pay rate from $20 to $25*/
    int bonus=0;bonus>1;bonus++; /* Adds $3000 to workers going over 70 hours*/

    normal_pay=hours*20;
    over_time=(hours-60)*40+normal_pay;
    bonus=over_time+3000;
    salary_deduct=hours*20-hours*10;

    if(hours<=40)
    printf("\nThe employee is slacking and salary will be deducted!\nThe gross pay is:$%d dollars\n",salary_deduct);
    else if(hours<=60)
    printf("\nThe employee will get normal pay\nThe gross pay is:$%d dollars\n",normal_pay);
    else if(hours<=70)
    printf("\nThe employee is working over time and will get overtime pay\nThe gross pay is:$%d dollars\n",over_time);
    else
    printf("\nTHE EMPLOYEE IS WORKING EXTREMELY HARD AND WILL GET A BONUS ON HIS PAY!\nThe gross pay is:$%d\n",bonus);
printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");    
}

int tax;{
    int normal_pay;
    int over_time; /*Overtime pay increases the pay rate from $20 to $25*/
    int bonus=0;bonus>1;bonus++; /* Adds $3000 to workers going over 70 hours*/
    int salary_deduct=0;salary_deduct>20;salary_deduct++;
    int hours;
    int education_tax;
    int NIS_tax;
    int NHT_tax;
    int medical_dental;
    education_tax=hours*20*.06;
    printf("Education tax of %6:$-%d\n",education_tax);
    NHT_tax=hours*20*.1;
    printf("NHT tax of %10:$-%d\n",NHT_tax);
    NIS_tax=hours*20*.05;
    printf("NIS tax of %5:$-%d\n",NIS_tax);
    medical_dental=hours*20*.05;
    printf("Medical/dental of %5:$-%d\n",medical_dental);
printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");

}

int ntpay;{
    int normal_pay;
    int over_time; /*Overtime pay increases the pay rate from $20 to $25*/
    int bonus=0;bonus>1;bonus++; /* Adds $3000 to workers going over 70 hours*/
    int education_tax;
    int NIS_tax;
    int NHT_tax;
    int medical_dental;
    int salary_deduct=0;salary_deduct>20;salary_deduct++;
    int hours;
    int netpay;
    int netpay1;
    int netpay2;
    int netpay3;

    netpay=salary_deduct-(NHT_tax+education_tax+NIS_tax+medical_dental);
    netpay1=normal_pay-(NHT_tax+education_tax+NIS_tax+medical_dental);
    netpay2=over_time-(NHT_tax+education_tax+NIS_tax+medical_dental);
    netpay3=bonus-(NHT_tax+education_tax+NIS_tax+medical_dental);

   if(hours<=40)
    printf("The net pay is:$%d\n",netpay);
    else if(hours<=60)
    printf("The net pay is:$%d\n",netpay1);
    else if(hours<=70)
    printf("The net pay is:$%d\n",netpay2);
    else
    printf("The net pay is:$%d\n",netpay3);
printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
}
}

Oh, you are a real winner....

please test and run it for me please i have to go sleep now...

Did I read this right? You really posted your code and you want us to test it for you? Yes, you are presumptuous. It's not our problem it's due Friday...

I said:

Do one at a time and test test test!!

Well, you did all 4 and didn't test it once. And just by looking this won't even compile.

If you decide to actually use the help you've been given, I'll help. As it is, I'm wasting my time. Good luck.

sorry about last night my head was killing me anyways i am doing a little reading and it says that i am suppose to declare function right? how would i declare a function for selection like with my thing cause i am not fully grasping this thing(obviously)and the declarations for these functions should that be above main?

i tried but it didnt work

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>



int main(int argc,char **argv)
{
printf("\t//*****************St.Jago High School******************\\ \n\n");
    printf("\t------------Courtney Athlone St.Michael Reid---------------\n\n");
      printf("\t^^^^^^^^^Computer Science IA-Pay Roll System^^^^^^^^^\n\n");

    char fname[50];
    char lname[20];

    printf("Enter the employee's First Name:\n");
    scanf("%s",&fname[50]);

    printf("Enter the employee's Last Name:\n");
    scanf("%s",&lname[20]);
int hours=0;
add_hours(&hours);
int bonus=40;
salaryselect(&bonus);
int salary_deduct=80;
salaryselect(&salary_deduct);
int normal_pay=60;
salaryselect(&normal_pay);
int over_time=70;
salaryselect(&over_time);
}
int add_hours(int *hours)
{
    int mo, tu, we, th, fr;
printf("Enter daily hours for Monday:\n");
scanf("%d",&mo);

printf("Enter daily hours for Tuesday:\n");
scanf("%d",&tu);

printf("Enter daily hours for Wednesday:\n");
scanf("%d",&we);

printf("Enter daily hours for Thursday:\n");
scanf("%d",&th);

printf("Enter daily hours for Friday:\n");
scanf("%d",&fr);
*hours=mo+tu+we+th+fr;
printf("\nThe weekly hours are:%d\n",*hours);

printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");

}

int salaryselect(int argc, int hours)
{


    int salary_deduct=0;salary_deduct>1;salary_deduct++;
    int normal_pay;
    int over_time; /*Overtime pay increases the pay rate from $20 to $25*/
    int bonus=0;bonus>1;bonus++; /* Adds $3000 to workers going over 70 hours*/

    normal_pay=hours*20;
    over_time=(hours-60)*40+normal_pay;
    bonus=over_time+3000;
    salary_deduct=hours*20-hours*10;

    if(hours<=40)
    printf("\nThe employee is slacking and salary will be deducted!\nThe gross pay is:$%d dollars\n",salary_deduct);
    else if(hours<=60)
    printf("\nThe employee will get normal pay\nThe gross pay is:$%d dollars\n",normal_pay);
    else if(hours<=70)
    printf("\nThe employee is working over time and will get overtime pay\nThe gross pay is:$%d dollars\n",over_time);
    else
    printf("\nTHE EMPLOYEE IS WORKING EXTREMELY HARD AND WILL GET A BONUS ON HIS PAY!\nThe gross pay is:$%d\n",bonus);

    printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
    printf("\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.