Jamaal is planning to invest up to $23000 in City Bank or State Bank. He wants to invest at least $4000 in City Bank, but not more than $16000; since State Bank does not insure more than $8000, he wants to invest no more than this amount in State Bank. The interest at City Bank is 5%, and the interest at State Bank is 7%. How much should he invest in each bank to earn the most interest? What is the maximum amount of interest that Jamaal can earn?