H
hmmtn
I would appreciate any help on this one. Assignment is as
follows: Develop a program that will determine the gross pay for each
of several employees. The company pays "straight time" for the first
40 hours worked by each employee and pays "time-and-a-half" for all
hours worked in excess of 40 hours. You are given a list of the
employees of the company, the number of hours each employee worked
last week and the hourly rate of each employee. your program should
input this information for each employee, and should determine and
display the employee's gross pay.
So far I have:
#include <stdio.h>
int main()
{
int hours;
int rate;
int salary;
int counter = 0;
printf( "Enter # of hours worked (-1 to end): " );
scanf( "%d", &hours );
printf( "Enter hourly rate of the worker ($00.00): " );
scanf( "%d", &rate );
while( hours != -1 )
counter++;
{
if( hours <= 40 )
{
salary = rate * hours;
}
else
{
salary = 40 * rate + (hours - 40) * (rate * 1.5);
}
printf( "Salary is %d\n", salary );
}
return 0;
}
I can't get it to show salary, or begin another loop right now.
Thanks in advance for any help.
follows: Develop a program that will determine the gross pay for each
of several employees. The company pays "straight time" for the first
40 hours worked by each employee and pays "time-and-a-half" for all
hours worked in excess of 40 hours. You are given a list of the
employees of the company, the number of hours each employee worked
last week and the hourly rate of each employee. your program should
input this information for each employee, and should determine and
display the employee's gross pay.
So far I have:
#include <stdio.h>
int main()
{
int hours;
int rate;
int salary;
int counter = 0;
printf( "Enter # of hours worked (-1 to end): " );
scanf( "%d", &hours );
printf( "Enter hourly rate of the worker ($00.00): " );
scanf( "%d", &rate );
while( hours != -1 )
counter++;
{
if( hours <= 40 )
{
salary = rate * hours;
}
else
{
salary = 40 * rate + (hours - 40) * (rate * 1.5);
}
printf( "Salary is %d\n", salary );
}
return 0;
}
I can't get it to show salary, or begin another loop right now.
Thanks in advance for any help.