Question 1 (10 Points) Many companies pay time and a half for any hours worked a
ID: 3590175 • Letter: Q
Question
Question 1 (10 Points) Many companies pay time and a half for any hours worked above 40 in each week. Write a well-documented Python program to input the number of hours worked and the hourly rate and calculate the total wages for the week. Question 2 (10 Points) Write a well-documented Python program that converts distances measured in kilometers to miles. Question 3(10 Points) Write a well-documented Python program computes and prints a table of Celsius temperatures and the Fahrenheit equivalents every ten degrees from 0 degrees C to 100 degrees C.Explanation / Answer
Answer for 1:
def hours():
hours = input("How many hours did you work? ") " " " Inputs the value" " "
return hours
def payrate():
payrate = input("How much is the payrate? ") " " " Inputs payrate" " "
return payrate
def calculatehours(pr,h): " " "calculates" " "
if h > 40:
rh = 40
oh = h - 40
else:
rh = h
oh = 0
print "Pay rate $%0.2f" % pr
print "Regular Hours %d" % rh
print "Overtime hours %d" % oh
print "Regular pay $%0.2f" % (rh * pr)
print "Overtime pay $%0.2f" % (oh * pr * 1.5)
print "Total Pay $%0.2f" % (rh * pr + oh * pr * 1.5)
def main():
hs = hours()
pyrt = payrate()
calchours (pyrt, hs)
main()
Answer for 2:
def main():
kil = int(input("Enter the number of Kilometers ")) " " "takes input in kilometers" " "
miles = kil * .62 " " "converts kilometers to miles" " "
print("The number of Miles is", miles) " " "prints miles" " "
main()
OUTPUT is as follows:
Enter the number of Kilometers 5.5
The number of Miles is 3.41
Answer for 3:
def main():
print("Printing a table of celsius and fahrenheit temperatures") " " " takes input" " "
print("every 10 degrees from 0C to 100C")
print("Celsius", "Fahrenheit")
for i in range (10, 101, 10):
cel = (i -32.0)* 5/9 " " " converts celsius to farenheit" " "
print("{0:.2f}" .format(cel), i)
main()
OUTPUT is as follows:
Hope this answer helps .Thank you
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.