How to populate an array and sum its contents.