Let they sold X number of sodas, then the number of water sold is 58-X
Cost of one soda = $3
Therefore the cost of X sodas are = 3X ..........(1)
Similarly, the cost of (58-X) water = 2(58-X) .............(2)
Total cost = 3X + 2(58-X) = 151
3X + 116 - 2X = 151
X = 151 - 116 = 35
This means sodas sold is = 35 and water sold = 58-35 = 23