A numerical method to solve the normal and tangential contact problem of elastic bodies