Hey there!!
The total cost is $52.
She paid $12 more for the layer cake than the cupcake.
Let's take the price of the cupcake as $x. Then, the price of the layer cake would be $12 + x
The sum of these would result in $52.
... x + x + 12 = 52
... 2x + 12 = 52
... 2x = 52 - 12
... 2x = 40
... x = 20
Hence, the price of the cupcake is $20 and the price of the layer cake is $32.
Hope my answer helps!!