A cake costs $10 and a pie costs $8.
Explanation:
Step 1; First we convert the given costs into separate equations. Assume 1 cake costs $x and 1 pie costs $y. Keep the known costs on the right side and the unknown ones on the left. By doing this we get the following equations
30x + 20y = 460, take this as equation 1
30x+ 40y = 620, take this as equation 2
Step 2; When we subtract equation 2 from equation 1, we cancel out the x variable and can calculate the value of y.
-20y = -160 , y = -160/-20 = $ 8.
Step 3; Substituting this value of y in any of the previous equations we will get x's value. Here this value of y is substituted in equation 1.
30x + 20(8) = 460, 30x + 160 = 460 , 30x = 300, x=10.
So a cake costs $10 and a pie costs $8.