The annual difference in gas cost is
... 12000(1/23 -1/48)×$2.42 ≈ $657.61
So, it will take (43,000 -24,000)/657.61 years ≈ 28.9 years for the better fuel economy to outweigh the initial cost difference.
_____
With the units where you can see them, the gas cost computation is ...
[tex]12000\,mi\times\left(\dfrac{1\,gal}{23\,mi}-\dfrac{1\,gal}{48\,mi}\right)\times \dfrac{\$2.42}{1\,gal}\approx \$657.609[/tex]