Joe went school supply shopping. He spent $22.50 on notebooks and pencils. Notebooks cost $2.00 and pencils cost $0.50. He brought a total of notebooks and pencils. How many pencils did he buy?

What i did
n+p=15
0.50n+2.00p=22.50

i dont know who to do so on because it doesnt tell you which he had more and etc ex( he had 4 more pencils then notebooks) explain please

2 equations and 2 unknowns, just solve the system by substitution or elimination

To solve this problem, we can set up a system of equations using the given information.

Let's use the variables n and p for the number of notebooks and pencils Joe bought, respectively.

From the problem, we know that the total number of notebooks and pencils Joe bought is 15. So, the first equation can be written as:

n + p = 15

We also know that notebooks cost $2.00 each and pencils cost $0.50 each. Joe spent a total of $22.50, so we can set up the second equation as:

2.00n + 0.50p = 22.50

Now, to determine the number of pencils Joe bought, we can solve this system of equations using either substitution or elimination.

Let's use the substitution method:

Rewrite the first equation as n = 15 - p

Substitute this expression for n in the second equation:

2.00(15 - p) + 0.50p = 22.50

Now, solve for p:

30 - 2.00p + 0.50p = 22.50
-1.50p = -7.50
p = -7.50 / -1.50
p = 5

Therefore, Joe bought 5 pencils.

Note: It's important to mention that in this problem, the information provided does not indicate any specific relationship between the number of notebooks and pencils Joe bought. Without additional information, we can only solve for the number of pencils or notebooks based on the given equations.