# Garden Material Calculator # import math print("This program calculates the amount of plants, soil,") print("and rock needed to the create the 'pictured garden,'") print("when given the measurements of the garden's ideal") print("plant spacing, length of garden, and soil/fill depths") print("="*55) print("Please keep all your measurements in feet") print("="*45) Length_side = input("Enter length of side of garden") Length_side_int = int(Length_side) Plant_spacing = input("Enter spacing between plants") Plant_spacing_flt = float(Plant_spacing) Garden_soil_depth = input("Enter depth of garden soil") Garden_soil_depth_flt = float(Garden_soil_depth) Rock_depth = input("Enter depth of rock") Rock_depth_flt = float(Rock_depth) print("="*32) Cir_rad = (Length_side_int/4) Semi_cir_area = (.5*math.pi*Cir_rad*Cir_rad) Cir_area = (math.pi*Cir_rad*Cir_rad) Cir_area_round = round(Cir_area,2) Plant_area = (Plant_spacing_flt * Plant_spacing_flt) Rock = Length_side_int*Length_side_int Rock_area =(Rock - (4*Semi_cir_area + Cir_area_round)) Semi_cir_garden = round(Semi_cir_area/Plant_area,2) Cir_garden = round(Cir_area_round/Plant_area,2) Total_plant = round(4*Semi_cir_garden + Cir_garden) Soil_semi_cir = ((Semi_cir_area/3 * Garden_soil_depth_flt/3)) Soil_cir = ((Cir_area/3 * Garden_soil_depth_flt/3)) Total_soil_garden = (4*Soil_semi_cir + Soil_cir) Total_rock_garden = ((Rock_area/3 * Rock_depth_flt/3)) Soil_semi_cir_round = round(Soil_semi_cir,2) Soil_cir_round = round(Soil_cir,2) Total_soil_garden_round = round(Total_soil_garden,2) Total_rock_garden_round = round(Total_rock_garden,2) print("Area for a semi-circle garden",Semi_cir_garden,"ft.^2") print("Area for a circle garden",Cir_garden,"ft.^2") print("The total number of plants needed are",Total_plant) print("Amount of soil needed for semi-circle garden",Soil_semi_cir_round,"yd.^2") print("Amount of soil needed for circle garden", Soil_cir_round,"yd.^2") print("Total amount of soil needed",Total_soil_garden_round,"yd.^2") print("Total amount of rock needed",Total_rock_garden_round,"yd.^2") import turtle # imports turtle program turtle.shape("turtle") # changes turtle shape to a turtle turtle.speed(10) # changes the speed of the turtle def draw_garden(radius): draw_circle(radius) turtle.penup() turtle.forward(radius+radius/100) turtle.right(90) turtle.forward(radius) turtle.left(180) turtle.pendown() draw_semi_circle(radius) turtle.forward(radius*2-radius/50) turtle.left(90) turtle.forward(radius*2) turtle.left(90) turtle.pendown() draw_semi_circle(radius) turtle.penup() turtle.forward(radius*3) turtle.left(90) turtle.forward(radius) turtle.left(90) turtle.pendown() draw_semi_circle(radius) turtle.penup() turtle.forward(radius*2+radius/50) turtle.left(180) turtle.pendown() draw_semi_circle(radius) turtle.penup() turtle.forward(radius) turtle.left(90) turtle.forward(radius*2) turtle.left(92) turtle.forward(5) turtle.pendown() draw_square(radius) def draw_circle(radius): turtle.penup() turtle.goto(0,-100) turtle.pendown() turtle.circle(radius) def draw_square(radius): turtle.forward(radius*4) turtle.left(90) turtle.forward(radius*4) turtle.left(90) turtle.forward(radius*4) turtle.left(90) turtle.forward(radius*4) turtle.left(90) def draw_semi_circle(radius): arc_run = radius/55 arc_rise = radius/25 for i in range(78): turtle.left(arc_run) turtle.forward(arc_rise) turtle.left(92) turtle.forward(radius*2+radius/100) turtle.penup() turtle.goto(0,-100) draw_garden(float(Cir_rad*50))