Periodic solutions of continuous third-order differential equations with piecewise polynomial nonlinearities