P - potatoes, O - onions, A - apples.
9 P = 6 A
P = 2 O
A = P + 24
-------------------
A = 9 P / 6 = 3 P / 2
3 P / 2 = P + 24
1/2 P = 24
P = 24 - 2 = 48
A = 48 + 24 = 72
O = 1/2 * 48 = 24
Answer:
The cost of sweet potatoes is 48 cents, the cost of apples is 72 cents and the cost of onions is 24 cents.