Question: Exercise 1 A program was created that outputs the following unto the console: Hello! What is your name: Hello, Jane Doe! Using this program, we

Exercise 1

A program was created that outputs the following unto the console:

Hello! What is your name: Hello, Jane Doe! Using this program, we can help you determine you pay for the week! Please enter the hours you worked this week: 20 Next, please enter your rate of pay: 10 Calculating you will make $ 200 by the end of the week!

Here is the code for that program (you should have written a close variant of this last week

user_name = input("Hello! What is your name? ")

#Write the same greeting above with the users name

print("Hello, " + user_name + "! Using this program, we can help you determine you pay for the week!")

#Ask the user for the rate of pay following the same format from the output above

hours_worked = float(input("Please enter the hours you worked this week: "))

rate_of_pay = float(input("Next, please enter your rate of pay: "))

#Create a variable that multiplies the hours_worked and the rate_of_pay

pay_for_week = hours_worked * rate_of_pay

#Write a print statement that will output the last line of the output provided

print("Calculating you will make $" + str(pay_for_week) + " by the end of the week!")

Let's modify this program to comply with overtime rules. Let's give the employee 1.5 times the hourly rate for hours worked above 40 hours.

Here are some test cases:

  • If the number of hours worked is 45, and the rate of pay is 10, you should get 475.0 (10/hr for 40 hrs, and 15/hr for 5 hrs).
  • If the number of hours worked is 35, and the rate of pay is 10, you should get 350.0 (10/hr for 35 hrs).
  • If the number of hours worked is 63, and the rate of pay is 10, you should get 745.0 (10/hr for 40 hrs, and 15/hr for 23)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!