First find the total number of degrees the candy needs to heat up: 240 degrees - 60 degrees = <<240-60=180>>180 degrees
Then divide that amount by the rate the candy heats up: 180 degrees / 5 degrees/minute = <<180/5=36>>36 minutes
Then find the number of degrees the candy needs to cool down: 240 degrees - 170 degrees = <<240-170=70>>70 degrees
Then divide that by the rate the candy cool down: 70 degrees / 7 degrees/minute = <<70/7=10>>10 minutes
Then add the time for the candy to heat to the time for it to cool to find the total time: 10 minutes + 36 minutes = <<10+36=46>>46 minutes
#### 46