(1) The path the dog used forms two legs of a right triangle, and the hypotenuse is the straight line distance between the dog and its master=√(15²+10²) (Pythagoras). This distance is √325=5√13=18.03 ft approx.
(2) Let S, H and P be the costs of a shirt, a hat and a pin respectively.
(a) 2S+2H+4P=140,
(b) 4S+H+3P=195, so H=195-4S-3P,
(c) H+10P=70, so H=70-10P.
Therefore 195-4S-3P=70-10P, 195-70+7P=4S, S=¼(125+7P).
Substitute these values of H and S into (a):
½(125+7P)+2(70-10P)+4P=140, then double this:
125+7P+280-40P+8P=280,
125-25P=0, P=$5. So H=70-50=$20 and S=¼(125+35)=160/4=$40.
Shirt costs $40, hat costs $20 and a pin costs $5.