Question: Q2 Sequential - If-Else Given that an employees weekly pay is based on her category: Category 1: Salary, Category 2: Hourly For the hourly category,
Q2 Sequential - If-Else
Given that an employees weekly pay is based on her category:
Category 1: Salary,
Category 2: Hourly
For the hourly category, there are two subcategories: regular hours & overtime. Regular hours are are 40, and they have their own rate. Overtime hours have an overtime rate. Use the below variables in your code:
hourlyRate = 15
overtimeRate= 20
salaryRate = 500
Write a single Sequential /Decision python code block that will accept a category variable x where x can only be salary or hourly
Use each input below to demonstrate your code: that is, run case 1, by setting x = salary and get a print of the pay, then run case 2 and get a print of the pay.
Case 1:
x = salary
Case2:
x = hourly and hours = 44
Solution Hint: For case 1, you will simply output the salary rate that is given above. For case 2, you will consider the hourly rate for the first 40 hours, and then you will consider the overtime rate for the remaining 4 hours.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
