The method for calculating the nuclear-quadrupole-deformation parameter on the basis of a self-consistent anisotropic oscillator potential is modified in such a way that it becomes possible to take phenomenologically into account the resistance of closed nucleon shells against changes in the spherical shape of the nuclear surface. This approach enables one to describe satisfactorily the deformation of beta-stable nuclei in the mass region A>16. The possibility of performing such calculations for nuclei occurring far from the beta-stability valley is also considered.