In this paper, we consider a class of optimal control problems in which the dynamical system involves a finite number of switching times together with a state jump at each of these switching times. The locations of these switching times and a parameter vector representing the state jumps are taken as decision variables. We show that this class of optimal control problems is equivalent to a special class of optimal parameter selection problems. Gradient formulas for the cost functional and the constraint functional are derived. On this basis, a computational algorithm is proposed. For illustration, a numerical example is included.