A generalization of the Blume-Emery-Griffiths model is introduced in which an entropy stabilization of the high-temperature phase is controlled by a degeneracy parameter p greater than or equal to 1. The model describes a first- and a second-order phase transition as a function of temperature between two ordered phases. This is relevant for the martensitic transition problem. Mean-field calculations and Monte Carlo simulations are presented. The model predicts a constant entropy change at the transition for various transition temperatures in agreement with the behavior found experimentally.