//Make an interactive program that will ask for
hourly rate of the employee and the number of
hours worked in a day. As DOLE mandates, more
than 8 hours of work a day is considered OT
(overtime) so the wage will be 1.5 * hourly
rate after the 8 hours of work.using loops,
compute the weekly wage.Given 6 days of work
in a week.Output the gross salary and net
salary( gross salary less 12%.)//
I dont know how work with the overtime...
here's my code..
#include <stdio.h>
int main()
{
int day,hRate,wHours,;
int total = 0;
int i = 1;
float cTax,gross,salary,nSalary,aTotal;
float tax = .12;
printf("Enter Hourly Rate: ");
scanf("%d",&hRate);
printf("Enter number of days you've worked: ");
scanf("%d",&day);
if (i <= day)
{
while (i <= day)
{
printf("\nEnter number of hours you worked in Day %d: ",i);
scanf("%d",&wHours);
salary=wHours*hRate;
printf("\nYour salary for day %d is %.2f \n",i,salary);
i=i+1;
total=total+salary;
}
}
else
if ( wHours > 8)
{
while (i <= day)
{
printf("\nEnter number of hours you worked in Day %d: ",i);
scanf("%d",&wHours);
salary=wHours*(hRate*1.5);
printf("\nYour salary for day %d is %.2f \n",i,salary);
i=i+1;
total=total+salary;
}
}
aTotal = total;
printf("\nYour weekly gross salary is %.2f", aTotal);
cTax =tax*total;
printf("\n\n the tax is %.2f",cTax );
gross=aTotal-cTax;
printf("\n\n weekly net salary is %.2f", gross);
getchar();
getchar();
}