I am creating a method called getAveragePrice and I need it to calculate the average of values in an undefined array list (which would only be defined during the testing/implementation of said method).
public double getAveragePrice() {
double sum = 0;
int x = 0; //counting variable
do {
That is what I have right now for a start. I know that every time a value is added to the sum the count of x needs to increase by 1 so the method knows what to divide the final sum by. The only issue I have is how to set up a do loop to give me the sum of the values in an array list.