Yeah, that looks right, but when you write it out you have two separate equations: the first being the more general \(s(t)=40t+\cos t+C\) and the second involving the initial values, \(s(0)=40(0)+\cos 0+C=2\).
Anyway, solving for C and plugging it into the first equation gives you your answer.