write Python program prompts the user to input number of hours worked, hourly rate and output pay
Fantastic news! We've Found the answer you've been seeking!
Question:
- write Python program prompts the user to input number of hours worked, hourly rate and output pay amount. If hours worked is over 40 hours, calculate overtime pay (1.5 times of hourly rate). If hours worked is over 60 hours, calculate double overtime pay (2 times of hourly rate). Also, if user enters wrong input (entering characters, negative numbers, etc.) your program needs to display message informing user of wrong input. Once error message gets displayed, you need to ask user to provide proper inputs again. Hourly rate and number of hours worked can be integers or floating point numbers.
- you need to utilize the function to carry out calculation of the pay. have to make a function called CalPay (hrs, rate) which will take two arguments and return pay amount. Also, after displaying pay amount, the program needs to ask user whether user wants to repeat it or not. If user wants to repeat, your program has to start same procedure by utilizing loop. Also, have to use "while" loop.
- output must be exactly same as this:
- Please enter number of hours worked for this week: 40
What is hourly rate? 10
Your pay for this week is: $400.0
==========================================================
Do you want another pay calculation? (y or n) y
Please enter number of hours worked for this week: kk
You entered wrong information for number of hours.
Please enter number of hours worked for this week: 60
What is hourly rate? kk
You entered improper information for the rate.
What is hourly rate? 10
Your pay for this week is: $700.0
==========================================================
Do you want another pay calculation? (y or n) y
Please enter number of hours worked for this week: 70
What is hourly rate? 10
Your pay for this week is: $900.0
==========================================================
Do you want another pay calculation? (y or n) n
Related Book For
Microsoft Visual C# An Introduction to Object-Oriented Programming
ISBN: 978-1337102100
7th edition
Authors: Joyce Farrell
Posted Date: