7Factor interview question

Fix this terrible code and then tackle this problem