A car travels a total distance of 150 miles. The speed of a car is 20 miles per hour for the first three hours and 30 miles per hour for the remaining t hours. Find the total time taken by the car (in hours) to cover the distance. (Hint: Distance = speed × time)