A
AR
Hi
I am trying to figure out how to set up the conditions of my for loop
in a nested loop program. I am missing some key element in either or
both the syntax of the for loop and/or the placement of the for loop
in my program. I could use some help.
thanks
PS I tried to only include the part of the program I needed help
completing.
void GetInfo(void)
{
{
printf("\n\nMountain Pacific Corporation\n");
printf("Department Salary Program\n\n");
printf("Please enter the name of the Department: ");
scanf("%s", department);
for(count_EMP = 1; count_EMP > 1; count_EMP++)
do {
printf("\nEnter employee # %d: ", count_EMP);
scanf("%s %s", &Fname, &Lname);
printf("\nPlease enter the hourly wage for the employee: ");
scanf("%f", &wage);
printf("\nPlease enter the number of hours worked this week:
");
scanf("%f", &hours);
printf("\nThank you. Process another employee?");
scanf("%s", &again);
printf("End of processing\n\n\n");
}while(again != 'Y' && again!= 'y');
if (RegHr > 40)
{
OTHr = hours - 40;
OTHrPay = OT * OTHr * wage;
RegHrPay = 40.0 * wage;
}
else
{
RegHrPay = hours * wage;
OTHrPay = 0.0;
}
GrossPay = RegHrPay + OTHrPay;
strcpy(FULLNAME, Fname);
strcat(FULLNAME, " ");
strcat(FULLNAME, Lname);
printf("\n\nMountain Pacific Corporation\n");
printf("Department Salary Program\n\n");
printf("Employee Reg Hrs "
"Overtime Hrs Gross\n");
printf("-----------------------------------------"
"-----------------------------\n\n");
printf("%-12s%9.1f%2c($%.2f)%12.1f%2c($%.2f)%c%15.2f\n\n",
FULLNAME,
hours, ' ', wage, OTHr, ' ', OTHrPay, ' ', GrossPay);
}
}
I am trying to figure out how to set up the conditions of my for loop
in a nested loop program. I am missing some key element in either or
both the syntax of the for loop and/or the placement of the for loop
in my program. I could use some help.
thanks
PS I tried to only include the part of the program I needed help
completing.
void GetInfo(void)
{
{
printf("\n\nMountain Pacific Corporation\n");
printf("Department Salary Program\n\n");
printf("Please enter the name of the Department: ");
scanf("%s", department);
for(count_EMP = 1; count_EMP > 1; count_EMP++)
do {
printf("\nEnter employee # %d: ", count_EMP);
scanf("%s %s", &Fname, &Lname);
printf("\nPlease enter the hourly wage for the employee: ");
scanf("%f", &wage);
printf("\nPlease enter the number of hours worked this week:
");
scanf("%f", &hours);
printf("\nThank you. Process another employee?");
scanf("%s", &again);
printf("End of processing\n\n\n");
}while(again != 'Y' && again!= 'y');
if (RegHr > 40)
{
OTHr = hours - 40;
OTHrPay = OT * OTHr * wage;
RegHrPay = 40.0 * wage;
}
else
{
RegHrPay = hours * wage;
OTHrPay = 0.0;
}
GrossPay = RegHrPay + OTHrPay;
strcpy(FULLNAME, Fname);
strcat(FULLNAME, " ");
strcat(FULLNAME, Lname);
printf("\n\nMountain Pacific Corporation\n");
printf("Department Salary Program\n\n");
printf("Employee Reg Hrs "
"Overtime Hrs Gross\n");
printf("-----------------------------------------"
"-----------------------------\n\n");
printf("%-12s%9.1f%2c($%.2f)%12.1f%2c($%.2f)%c%15.2f\n\n",
FULLNAME,
hours, ' ', wage, OTHr, ' ', OTHrPay, ' ', GrossPay);
}
}