Variables
• p: number of pizza slices purchased
,
• s: number of sodas purchased
,
• t: total cost
Given that there are 8 students and each student receives 2 slices of pizza, then:

That is, they have to purchase 16 slices of pizza.
Given that there are 8 students and each student receives one can of soda, then:

That is, they have to purchase 8 cans of soda.
If 1 can of soda costs $1.50, then, s cans of soda will cost 1.5s dollars
If 1 slice of pizza costs $3, then, p slices will cost 3p dollars
The total cost is the addition of the cost of sodas and the cost of pizza, then:

Substituting p = 16 and s = 8 into the last equation, we get:
