KCS: Programming exercises week 4