The mayor and city council of any city of the first class or city of the second class or the village board of trustees of any village shall have the power to construct, replace, repair, or otherwise improve sidewalks within such city or village. Whenever the mayor and city council or village board of trustees shall by resolution passed by a three-fourths vote of all members of such city council or village board of trustees determine the necessity for sidewalk improvements, the mayor and city council or village board of trustees shall by ordinance create a sidewalk district, shall cause such improvements to be made, and shall contract therefor.