Let x be the number of gallons of 50% antifreeze.
The volume of mixture is 80+x.
The quantity of antifreeze is 0.5x+0.1*80=0.4(80+x)=32+0.4x.
0.1x=32-8=24 so x=240 gallons.
CHECK
Total volume is 80+240=320 gallons.
Amount of antifreeze is 120+8=128 gallons.
Amount of antifreeze in the mixture is 128/320=2/5=0.4 or 40%.