We have shown that a Lagrangian for a torus surface can yield second-order nonlinear differential equations using the Euler-Lagrange formulation. It is seen that these second-order nonlinear differential equations can be transformed into the nonlinear quadratic and Mathews-Lakshmanan equations using the position-dependent mass approach developed by Mustafa (J. Phys. A: Math. Theor. 48, 225206 (2015)) for the classical systems. Then, we have applied the quantization procedure to the nonlinear quadratic and Mathews-Lakshmanan equations and found their exact solutions.