An athlete completed a 240-mile training ride in two segments. For the first 3 hours, she cycled at an average speed of 50 miles per hour. She then completed the remaining distance cycling at an average speed of 45 miles per hour. What was the total time, in hours, the athlete spent on the training ride?