Let,
David has X marbles
Matthew has Y marbles
Joseph has 5 times of Matthew so , 5Y marbles
Here,
X+5y=328 .....(1)
X+Y=176 .....(2)
From (1)-(2),
4Y=152
or,Y=38
By putting Y=38 in(2),
X+38=176
or,X=138
So David has 138
Matthew has 38
and Joseph has 5*38=190 marbles ....