Answer: it will take 6.6 years for both costs to be the same.
Explanation:
Let x represent the number of years that it will take for the total cost of fixing the car to equal the total cost of replacing it.
It will cost Mary $1200 to fix her car. Her present car uses about $2000 worth of gas per year, it means that the total cost of fixing the car and using it for x years is
1200 + 2000x
It will cost her $4500 to buy a new car while gas for the new car would cost about $1500 per year. it means that the total cost of buying the car and using it for x years is
4500 + 1500x
Therefore, for the total cost of fixing the car to equal the total cost of replacing it, the number of years would be
1200 + 2000x = 4500 + 1500x
2000x - 1500x = 4500 - 1200
500x = 3300
x = 3300/500
x = 6.6