I agreed with yuki that the question is wrong. I guess you typed wrongly the price of ballpen should be $6 (instead of $7). If that is the case, my answer is below :
Let N be the number of ballpens that are bought by Dick.
18 x 3 + 6 x N = 114
6N = 114 - 54
N = 60/6 = 10
Hence, 10 ballpens are bought by Dick.
This is a wrong question.
3 books cost $18x3 = $54
If total cost is $114, $114-$54 are used for buying ballpens
$60/7 = 8.57....
Dick can't buy 8.57 支ballpens.因為一定要係整數.