program5_2.py You have a business that cleans floors in commercial space and offices. You charge customers $0.45 per square yard, and some customers require multiple cleanings every month. You need two custom functions for your business. The first function takes a floor's length and width in feet and returns the area in square yards. The second void function takes the area, charge per square yard, and number of monthly cleanings as arguments and prints the cleaning cost. This latter function uses selection (if...else) logic to print different output for single and multiple monthly cleanings (see Sample Outputs). Use a properly named constant for the charge per square yard, too. import math def main(): length = int(input("Enter the floor length in feet ")) width = int(input("Enter the floor width in feet ")) numberOfCleanings = int(input("Enter the monthly number of cleanings ")) pricePerSqYrd = 0.45 area = getSqYrds (length, width) charge = printCleaningCost (area,pricePerSqYrd) if numberOfCleanings==1: print("Cleaning cost $",math.ceil(charge)) else: print("Cleaning cost $",charge,numberOfCleanings," times monthly $",charge*numberOfCleanings) def getSqYrds (length, width): yards = (length * width *0.111) return yards def printCleaningCost (areaSqYrd, pricePerSqYrd) : return areaSqYrd*pricePerSqYrd if __name__ == "__main__": main() program5_3.py See if __name__ == '__main__': What is this? in Learn Here for this one. Make a copy of program5_2.py named program5_3.py. Then, modify it to import and use program5_2 as a module file. The sample outputs should be the same. Check the first question and help me solve the second one.
program5_2.py
You have a business that cleans floors in commercial space and offices. You charge customers $0.45 per square yard, and some customers require multiple cleanings every month. You need two custom functions for your business. The first function takes a floor's length and width in feet and returns the area in square yards. The second void function takes the area, charge per square yard, and number of monthly cleanings as arguments and prints the cleaning cost. This latter function uses selection (if...else) logic to print different output for single and multiple monthly cleanings (see Sample Outputs). Use a properly named constant for the charge per square yard, too.
import math
def main():
length = int(input("Enter the floor length in feet "))
width = int(input("Enter the floor width in feet "))
numberOfCleanings = int(input("Enter the monthly number of cleanings "))
pricePerSqYrd = 0.45
area = getSqYrds (length, width)
charge = printCleaningCost (area,pricePerSqYrd)
if numberOfCleanings==1:
print("Cleaning cost $",math.ceil(charge))
else:
print("Cleaning cost $",charge,numberOfCleanings," times monthly $",charge*numberOfCleanings)
def getSqYrds (length, width):
yards = (length * width *0.111)
return yards
def printCleaningCost (areaSqYrd, pricePerSqYrd) :
return areaSqYrd*pricePerSqYrd
if __name__ == "__main__":
main()
program5_3.py
See if __name__ == '__main__': What is this? in Learn Here for this one.
Make a copy of program5_2.py named program5_3.py. Then, modify it to import and use program5_2 as a module file. The sample outputs should be the same.
Check the first question and help me solve the second one.
Step by step
Solved in 3 steps with 1 images