This work presents an algorithm for modeling a static spherically symmetric compact object satisfying the Eiesland condition (Eiesland in Am Math Soc 27:213, 1925), a necessary and sufficient condition that a general centrosymmetric space shall be of the class 1. The model parameters are obtained accordingly by employing the boundary conditions to the interior solutions. The equation of state has been extracted from the solution and one found that it is almost linear. These models are free of physical and geometric singularities and satisfy the necessary physical conditions to have astrophysical significance. The central and surface densities, and pressures of some compact stars like PSR J1614-2230, Vela X-1 have been calculated from these models. Detailed analyses of these models have also been made with the help of numerical and graphical studies. Fatema, Department of General Education, Daffodil International University, Dhaka-1207, Bangladesh, for her motivation, inspiration and continuous support. The author also acknowledges the library of BRAC university for the facilities provided. The author also expresses his sincere gratitude to the anonymous reviewer for the constructive comments.