Number of packs of Cherry soda: C
Number of packs of Vanilla soda: V
You buy 50 packs:

Cherry soda cost $4.50 per pack and Vanilla soda $5.00 per pack. In total you spent $238.50 on soda:

Then, the system of equations for the given scenario is:

To solve the system of equations:
1. Solve one of the variables in the first equation:

2. Substitute the C in the second equation by the value of C you get in step 1:

3. Solve V:

4. Use the value of V you get in step 3 and solve C:

Then, you bought 23 packs of Cherry soda and 27 packs of Vanilla soda