Changed 'for' loops to 'enhanced for' loops. Initialized array. Added test data to main.