Final answer:
By setting up a system of equations with one equation for the total number of cakes and another for the total cost, and then solving it, we find that 5 pieces of the first variety (at $12 each) and 15 pieces of the second variety (at $20 each) were bought.
Step-by-step explanation:
To solve the problem of determining how many pieces of each variety of cake were bought, we can use a system of equations. Let's denote the number of variety 1 cakes, which cost $12 each, as x, and the number of variety 2 cakes, which cost $20 each, as y.
The first equation comes from the total number of cakes bought: x + y = 20. The second equation comes from the total cost of the cakes: 12x + 20y = 360.
Now we can solve this system of equations step-by-step:
- Multiply the first equation by 12: 12x + 12y = 240.
- Subtract this new equation from the second equation to eliminate x: (12x + 20y) - (12x + 12y) = 360 - 240.
- Simplify to find y: 8y = 120.
- Divide by 8 to find y: y = 15. This means 15 pieces of the second variety were bought.
- Substitute y = 15 back into the first equation to find x: x + 15 = 20.
- Solve for x: x = 5. This means 5 pieces of the first variety were bought.
Thus, 5 pieces of the $12 variety and 15 pieces of the $20 variety were bought to make a total of 20 pieces for $360.