Set up a system of equations:


x is how many cakes were made, y is how many pies were made, 5 represents the cost of each cake, and 7 represents the cost of each pie.
We'll solve the system through elimination. Multiply the entire first equation by -5:

The system should now look like this:


Combine the two equations to eliminate x:

Divide both sides by 2 to get y by itself:

There were 8 pies made.
Plug in the value for y into the original first equation:

Subtract both sides by 8 to get x by itself:

There were
7 cakes made.