Section 24. The town of residence of a person who is required by section twenty-two to attend a continuation school of another town shall pay to such other town a tuition fee to be fixed by the commissioner of education, and not to exceed the average annual maintenance cost per pupil of continuation schools throughout the commonwealth, as last ascertained. In default of payment, such fee may be recovered in an action of contract.