# LANDSCAPE GARDENING QUOTE # Frans Coenen # University of Liverpool # 18 March 2013 # Constants LAWN_COST = 15.5 PATIO_COST = 20.99 WATER_FEATURE_COST = 150.0 LABOUR_COST = 16.49 LAWN_TIME = 20.0 PATIO_TIME = 20.0 WATER_FEATURE_TIME = 60.0 # Function to input details of a landscape item defined by a length # and width def inputDimensionsForTypeOneItem(item) : s = 'Enter length of ' + item + ': ' length = int(input(s)) s = 'Enter width of ' + item + ': ' width = int(input(s)) return(length,width) # Function to input details of a landscape item defined by a quantity def inputNumberForTypeTwoItem(item) : s = 'Enter number of ' + item + ': ' quantity = int(input(s)) return(quantity) # Function to calculate, output to screen and return the material cost # and time required to instal a landscape item defined in terms of a # length and width def costCalculationTypeOneItem(num,item,length,width,cost,time) : print('[ {0} ]'.format(num)) print('Length and width of the {0} area = {1} x {2} (m)'.\ format(item,length,width)) area = length * width print('Total area of the {0} = {1:.2f} (m^2)'.format(item,area)) print('Cost of the {0} = {1} pounds (per m^2)'.format(item,cost)) totalCost = area * cost print('Total cost of the {0} = {1:.2f} pounds\n'.\ format(item,totalCost)) totalTime = area * time return totalCost, totalTime # Function to calculate, output to screen and return the material cost # and time required to instal a landscape item defined in terms of # quantity def costCalculationTypeTwoItem(num,item,quantity,cost,time) : print('[ {0} ]'.format(num)) print('Number of {0} = {1}'.format(item,quantity)) print('Cost of one {0} = {1} pounds'.format(item,cost)) totalCost = quantity * cost print('Total cost of {0} x {1} = {2:.2f} pounds\n'.\ format(quantity,item,totalCost)) totalTime = quantity * time return totalCost, totalTime # Inputs lawnLength, lawnWidth = inputDimensionsForTypeOneItem('lawn') patioLength, patioWidth = inputDimensionsForTypeOneItem('concrete_patio') waterFeartureQuantity = inputNumberForTypeTwoItem('water_features') # Calculate cost and time (and output to screen) lawnCost, lawnTime = costCalculationTypeOneItem(1,'lawn',lawnLength, \ lawnWidth,LAWN_COST,LAWN_TIME) patioCost, patioTime = costCalculationTypeOneItem(2,'concrete_patio', \ patioLength,patioWidth,PATIO_COST,PATIO_TIME) waterFeatureCost, waterFeatureTime = costCalculationTypeTwoItem(3, \ 'water_features',waterFeartureQuantity,WATER_FEATURE_COST, \ WATER_FEATURE_TIME) # Calculate working costs print('Working Costs:') totalTime = (lawnTime + patioTime + waterFeatureTime) / 60.0 labourCost = totalTime * LABOUR_COST print('Total Time to Complete the work (labour) in hours = {0:.2f}'. \ format(totalTime)) print('Cost of the work (per hour) = {0:.2f}'.format(LABOUR_COST)) print('Total cost of the work (labour) = {0:.2f}\n'.format(labourCost)) # Calculate total fee payable by the customer materialCost = lawnCost + patioCost + waterFeatureCost totalCost = materialCost + labourCost print('Total fee payable by the customer (labour + materials) = \ {0:.2f}\n'.format(totalCost))