MOT4143 Pyhton 1. Write and test a program that computes the area of a circle. T
ID: 3743004 • Letter: M
Question
MOT4143 Pyhton
1. Write and test a program that computes the area of a circle. This program should request a number representing a radius as input from the user. It should use the formula 3.14 * radius ** 2 to compute the area and then output this result suitably labeled.
2. The tax calculator program of the case study outputs a floating-point number that might show more than two digits of precision. Use the round function to modify the program to display at most two digits of precision in the output number.
3. An employee’s total weekly pay equals the hourly wage multiplied by the total number of regular hours plus any overtime pay. Overtime pay equals the total overtime hours multiplied by 1.5 times the hourly wage. Write a program that takes as inputs the hourly wage, total regular hours, and total overtime hours and displays an employee’s total weekly pay.
Explanation / Answer
Python program for problem 1:
radius = float(input("Enter a radius of the circle:"))
#calcualting area of the circle
area = 3.14*radius*radius;
#priting area of the circle
print("Area of the circle:")
print(area)
Output:
Python program for problem 3:
hourlyWage = float(input("Enter hourly wage:"))
regularHours = float(input("Enter total regular hours:"))
overTimeHours = float(input("Enter total overtime hours :"))
#Calulating Overtime Pay
overTimePay= overTimeHours * 1.5* hourlyWage;
#Calculating Weekly pay
weeklyPay = hourlyWage * regularHours + overTimePay;
#priting area of the circle
print("Employee’s total weekly pay:")
print(weeklyPay)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.