This is where i'm at now.
Code:
int main() {
int num_hours_worked, employee_type, overtime_hours_worked;
float weekly_pay, overtime_pay, pay_rate;
printf("Are you and hourly employee (1) or a manager (0)?\n");
scanf("%d", &employee_type);
printf("How many hours did you work this week?\n");
scanf("%d", &num_hours_worked);
printf("What is your hourly pay rate?\n");
scanf("%f", &pay_rate);
if (employee_type == 0) {
weekly_pay = (pay_rate * 50.0);}
else if (employee_type == 1) {
if (num_hours_worked <= 40)
(weekly_pay = (pay_rate * num_hours_worked));}
else {
(overtime_hours_worked) = (num_hours_worked - 40);
(overtime_pay) = ((pay_rate * 1.5) * (overtime_hours_worked));
(weekly_pay) = (weekly_pay + overtime_pay);}
printf("You will get paid $%f this week.\n", weekly_pay);
return 0;
}
everything works well except overtime pay. do i need to redefine weekly_pay for the last block? regardless of the numbers i put in, if it's more than 40 hours of work, the pay comes back as $00.000000..