In: Computer Science
Tom and Jerry opened a new lawn service. They provide three types of services: mowing, fertilizing, and planting trees. The cost of mowing is $35.00 per 5000 square yards, fertilizing is $30.00 per application, and planting a tree is $50.00. Write an algorithm that prompts the user to enter the area of the lawn, the number of fertilizing applications, and the number of trees to be planted. The algorithm then determines the billing amount.
Include:
Equations
Example Data
IPO Chart
Structure Chart
Pseudocode Algorithms
Equations
cost of mowing = $35 per 5000 square yards = $(35/5000) per square yards
cost of fertilizing = $30.00 per application
cost planting = $50.00 per tree
So, Total Bill in $ = [(area of the lawn in square yards)(35/5000)] + [(number of fertilizing applications)30] + [(number of trees to be planted)50]
Example Data (Sample Output of the algorithm)
IPO chart
Structure chart
Pseudocode of the Algorithm:
print "Please Enter area of the lawn in square yards"
Take input area_square_yards
print "Please Enter number of fertilizing applications"
Take input number_of_fert_appl
print "Please Enter number of trees to be planted"
Take input number_of_trees
Total_bill = (area_square_yards)*(35.0/5000.0) +
(number_of_fert_appl*30.0) + (number_of_trees*50.0)
print "Total Bill Amount = $", Total_bill
Python code for the given problem:
print "Please Enter area of the lawn in square yards"
area_square_yards = float(raw_input())
print "Please Enter number of fertilizing applications"
number_of_fert_appl = float(raw_input())
print "Please Enter number of trees to be planted"
number_of_trees = float(raw_input())
Total_bill = (area_square_yards)*(35.0/5000.0) +
(number_of_fert_appl*30.0) + (number_of_trees*50.0)
print "Total Bill Amount = $", Total_bill