    /*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package listlooping;
import java.util.*;
/**
 *
 * @author Matthew
 */
public class ListLooping {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        ArrayList<Double> myList = new ArrayList();
        myList.add(1.0);
        myList.add(2.0);
        myList.add(3.0);
        myList.add(4.0);
        myList.add(5.0);
        
        // Calculate the sum and print out the list
        double sum = 0.0;
        for(int i = 0; i<myList.size(); i++) {
            sum += myList.get(i);
            System.out.print(myList.get(i)+", ");
        }
        System.out.println("Sum: " + sum);
        
    }
    
}
