Please help me,

Wendy went to a bakery to buy cakes and doughnuts. She spent $14 altogether on 30 cakes and doughnuts. Each cake cost 40 cents and each doughnut cost 50 cents. How many cakes and doughnuts did she buy?

To solve this problem, we need to set up a system of equations to represent the given information.

Let's assume that Wendy bought x cakes and y doughnuts.

According to the problem, each cake costs $0.40, so the total cost of cakes is 0.40x dollars.
Similarly, each doughnut costs $0.50, so the total cost of doughnuts is 0.50y dollars.

The problem also states that Wendy spent $14 altogether, so we can write the equation:
0.40x + 0.50y = 14

Additionally, we know that Wendy bought a total of 30 cakes and doughnuts, so we can write another equation to represent that:
x + y = 30

Now we have a system of two equations:

0.40x + 0.50y = 14
x + y = 30

To solve this system of equations, we can use the method of substitution or elimination.

Let's solve it using the method of substitution:

From the equation x + y = 30, we can rewrite it as x = 30 - y.
Substitute this value of x in the first equation:

0.40(30 - y) + 0.50y = 14

Now we can simplify and solve for y:

12 - 0.40y + 0.50y = 14
0.10y = 2
y = 2 / 0.10
y = 20

Now that we know y = 20, we can substitute its value back into the equation x = 30 - y:

x = 30 - 20
x = 10

Therefore, Wendy bought 10 cakes and 20 doughnuts.