A semiclassical method for calculating the total energy and spatial distribution of electron density in spherically symmetric electron-ion systems is applied to atoms and both solid and hollow atomic clusters. Both exchange-correlation interaction and second-order gradient correction are taken into account. The contribution due to the fourth-order gradient correction is discussed. An expression is proposed for the oscillating correction to the averaged electron density. An expression is obtained for the equilibrium radius of a hollow cluster. The dependence of the equilibrium radius of an endohedral cluster on the valence of the central atom is analyzed.