Write an average-income function | Microsoft Coding Question