Question 513355
p = number of plain caps
4p = price of plain caps
d = number of deluxe caps
6d = price of deluxe caps
.
p + d = 40
so
p = 40-d
.
4p + 6d = 236
.
substitute p = 40-d
.
4*(40-d) + 6d = 236
.
160 -4d + 6d = 236
.
2d = 76
.
d = 38
.
p = 40-d
p = 40-38
p = 2
.
They appear to have bought 38 deluxe caps and 2 plain caps.
.
But always check your answer!  (I got it wrong the first time myself, and I've been doing algebra for 45 years.)
You used the first equation to find p, so you need to use the other equation to check the solution.
(Don't fall into the trap of using the same equation twice.)
.
4p + 6d = 236
4(2) + 6(38) = ??
8 + 228 = 236
Correct.
.
Answer:  38 students bought deluxe caps.
.
Done.