City man gets 12-year term for rape attempt