A numerical method for direct and inverse acoustic scattering problem