Carry out a calculation program to calculate the floor of a worker according to the conditions: 1. if I work 8 hours during 5 days a week, I earn $150 2. if I work $10 a week, my bonus is $20. 3. If I work more than $10 a week, I earn $30. 4. If I miss a day, $20 is deducted from My base salary
int calculate_salary(int hours, int days_missed) { int base_salary = 150; int overtime_hours = hours - 10; int overtime_salary = 0; if (overtime_hours > 0) { overtime_salary = overtime_hours * 30; } int base_salary_with_bonus = base_salary + 20; int base_salary_with_deduction = base_salary - 20; int salary = 0; if (hours <= 40) { if (days_missed == 0) { salary = base_salary_with_bonus; } else { salary = base_salary_with_deduction; } } else { if (days_missed == 0) { salary = base_salary_with_bonus + overtime_salary; } else { salary = base_salary_with_deduction + overtime_salary; } }