Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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,

  1. 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.
  2.  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.
  3. output must be exactly same as this:
  4. 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Heres a Python program that prompts the user for the num... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual C# An Introduction to Object-Oriented Programming

Authors: Joyce Farrell

7th edition

978-1337102100

More Books

Students also viewed these Programming questions

Question

What is an insurable interest? Why is it important?

Answered: 1 week ago