Matt spends $10 on 3 pens and 7 pencils and has some money left.

If he buys another pen, he will be short of $0,40. However, if he buys one more pencil, he will still have $0.60 left. How much does each pen cost?

number of pens --- x

number of pencils --- y

3x + 7y < 1000

4x + 7y = 1040 -- times 3 --- 12x + 21y = 3120
3x + 8y = 940 ---- times 4 --- 12x + 32y = 3760
subtract the last two equations:
11y = 640
y = 58.1818.. cents or $0.58
then sub back into 4x + 7y = 1040
x = 1740/11 or $1.58

so a pen costs $1.58

check:
3x + 7y = $8.82 which is < $10.00
4x + 7y = 10.40 , so he is short 0.40
3x + 8y = 9.60 , so he has 0.60 left, as required.
My answer is correct