Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

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

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

More Books

Students also viewed these Databases questions