Hey this is a different bit of code. but i'm having some issues with the math.
Code:
int main() {
int num_hours_worked, pay_rate, employee_type, overtime_hours_worked;
float weekly_pay_1, weekly_pay_2, weekly_pay_3, overtime_pay;
printf("Are you and hourly employee (1) or a manager (0)?\n");
scanf("%d", &employee_type);
if (employee_type == 0) {
printf("How many hours did you work this week?\n");
scanf("%d", &num_hours_worked);
printf("What is your hourly pay rate?\n");
scanf("%d", &pay_rate);
(weekly_pay_1) = (pay_rate * 50);
printf("You will get paid $%f this week.\n", weekly_pay_1);}
if (employee_type == 1) {
printf("How many hours did you work this week?\n");
scanf("%d", &num_hours_worked);
printf("What is your hourly pay rate?\n");
scanf("%d", &pay_rate);
(weekly_pay_2 = (pay_rate * num_hours_worked));
printf("You will get paid $%f this week.\n", weekly_pay_2);}
else if (employee_type == 1 && num_hours_worked > 40) {
(num_hours_worked % 40) == (overtime_hours_worked);
(overtime_pay) = (pay_rate * 1.5) * (overtime_hours_worked);
(weekly_pay_3) = (weekly_pay_2 + overtime_pay);
printf("You will get paid %f this week.\n", weekly_pay_3);}
return 0;
}
The math is almost always wrong. for example:
the user inputs 0 for "manager" and the manager gets paid a set salary for his/her hourly pay regardless of how many hours are worked. its always hourly pay * 50 hours. if employees work over 40 hours a week, the hours past 40 are considered overtime for which they get paid 1.5* as much as their usual hourly rate.
what did i do wrong?