Exact and approximate energy spectrum for the finite square well and related potentials