S
SK
Hi
I am trying a simpler version of a program I was trying to write. The
idea is to have someone enter the information and then at the end of
the program display all of the info. in a table. I have a feeling the
errors I am making are probably stupid but I would appreciate any
imput.
//Specs to be added later
//C Libraries
#include <stdio.h>
#include <math.h>
#include <string.h>
//Global Variable Declaratives
FILE*inp;
char Fname[10];
char Lname[10];
char department[20];
char again;
char FULLNAME[30];
int count_EMP;
int number_EMP;
float wage;
float OTwage;
float hours;
float RegHr;
float RegHrPay;
float OTHrPay;
float OTHr;
float GrossPay;
//Function Prototypes
void GetInfo(void);
void Process(void);
void Report(void);
int main(void)
{
GetInfo();
system("pause");
return 0;
}
void GetInfo(void)
{
do{
printf("\nPlease enter the first and last name of the
employee:");
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("\nDo you want to enter another employee into the
payroll for"
"week?");
scanf("%s", &again);
}while(again == 'Y' || again == 'y');
if (RegHr > 40)
{
OTHr = hours - 40;
OTHrPay = 1.5 * OTHr * wage;
RegHrPay = 40.0 * wage;
}
else
{
RegHrPay = hours * wage;
OTHrPay = 0.0;
}
GrossPay = RegHrPay + OTHrPay;
if(count_EMP>=1);
for (count_EMP = 0;
count_EMP < number_EMP;
count_EMP++);
strcpy(FULLNAME, Fname);
strcat(FULLNAME, Lname);
scanf("%s%f%f%f\n\n", &FULLNAME, &RegHr, &OTHr, &GrossPay);
if(again != 'Y' && again !='y');
printf("End of processing\n\n\n");
printf("\n\nMountain Pacific Corporation\n");
printf("Department Salary Program\n\n");
printf("Department: %s\n\n", department);
printf("Employee Reg Hrs "
"Overtime Hrs Gross\n");
printf("-----------------------------------------"
"-------------------------\n\n");
printf("%-20s%11.2f%11.2f%11.2f", FULLNAME, RegHr, OTHr,
GrossPay);
}
I am trying a simpler version of a program I was trying to write. The
idea is to have someone enter the information and then at the end of
the program display all of the info. in a table. I have a feeling the
errors I am making are probably stupid but I would appreciate any
imput.
//Specs to be added later
//C Libraries
#include <stdio.h>
#include <math.h>
#include <string.h>
//Global Variable Declaratives
FILE*inp;
char Fname[10];
char Lname[10];
char department[20];
char again;
char FULLNAME[30];
int count_EMP;
int number_EMP;
float wage;
float OTwage;
float hours;
float RegHr;
float RegHrPay;
float OTHrPay;
float OTHr;
float GrossPay;
//Function Prototypes
void GetInfo(void);
void Process(void);
void Report(void);
int main(void)
{
GetInfo();
system("pause");
return 0;
}
void GetInfo(void)
{
do{
printf("\nPlease enter the first and last name of the
employee:");
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("\nDo you want to enter another employee into the
payroll for"
"week?");
scanf("%s", &again);
}while(again == 'Y' || again == 'y');
if (RegHr > 40)
{
OTHr = hours - 40;
OTHrPay = 1.5 * OTHr * wage;
RegHrPay = 40.0 * wage;
}
else
{
RegHrPay = hours * wage;
OTHrPay = 0.0;
}
GrossPay = RegHrPay + OTHrPay;
if(count_EMP>=1);
for (count_EMP = 0;
count_EMP < number_EMP;
count_EMP++);
strcpy(FULLNAME, Fname);
strcat(FULLNAME, Lname);
scanf("%s%f%f%f\n\n", &FULLNAME, &RegHr, &OTHr, &GrossPay);
if(again != 'Y' && again !='y');
printf("End of processing\n\n\n");
printf("\n\nMountain Pacific Corporation\n");
printf("Department Salary Program\n\n");
printf("Department: %s\n\n", department);
printf("Employee Reg Hrs "
"Overtime Hrs Gross\n");
printf("-----------------------------------------"
"-------------------------\n\n");
printf("%-20s%11.2f%11.2f%11.2f", FULLNAME, RegHr, OTHr,
GrossPay);
}