let the speed of the motorboat be x kmph
the speed of the current be y kmph = 8 kmph
now,journey with the current:
speed=x+y=(x+8)kmph,time=2 hours
d=2(x+8)=(2x+16)km
now considering return journey:
speed=x-y=(x-8)kmph,time=3 hours
distance=3(x-8)=(3x-24)km
but the distance in both cases must be the same,
hence 2x+16=3x-24
16+24=3x-2x
x=40 kmph
Thus speed of the motorboat in still water=40kmph
Hope this helps,
good luck.