Question: Please provide the code without using the while true loop. Use only sentinel controled while loop Note: Use same documentation and design rules as previous
Please provide the code without using the while true loop. Use only sentinel controled while loop
Note:
Use same documentation and design rules as previous assignments.
The user will enter employee data using sentinel "quit" on the name. Read name, number of
dependents, and hours worked. Use an efficient sentinelcontrolled while loop to read, process, and
output earnings. Assume data is valid; no data validation is needed.
All employees earn $ per hour so this value should be set up as a global constant.
The report should look similar to the one shown below with respect to layout in formatted columns.
Gross pay is computed based on hours worked. If the person works less than or equal to hours, the
gross pay is hours time rate. If the person works more than hours, the gross pay is hours paid at
the hourly rate and hours over are paid at "time and a half" which is times the hourly rate.
Federal tax is gross paydependents State tax is of gross pay. Net pay is gross
pay minus taxes.
The report should make columns with strings and use decimals on monetary amounts. If the person
worked overtime, the amount of overtime is listed.
Display number of employees awarded overtime and the sum of overtime pay at bottom of the report.
Code Specifications:
No global variables are accepted. All variables should be introduced in the function where they are
used and passed to functions via the parameter list. Global constants are acceptable. Infinite while
True: loopsare not accepted. Use of break, continue or other jump statements are not accepted.
Functions:
Write the following functions. Do not change the function headings or purpose. Include the comments.
Include the main function at the top of the code
def main :
This function returns the gross pay.
def computePay hours:
# return gross pay
This function returns the overtime pay.
def computeOverPay hours:
# return overtime pay
This function is passed the gross pay and the number of dependents and returns the federal tax.
def federaltax gross dependents : # return amount of federal tax
This function is passed the gross pay and and returns the state tax.
def statetax gross : # return amount of state tax
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
