Answer:

1.2 + 2.8 + 1.0  =   5.0

Summing the numbers in an Array

In answering the question you could start with the number on the left, and then proceed left to right through the remaining numbers. Here is a program that does that to sum the numbers in an array. This array contains values of type double.

class SumArray
{

  public static void main ( String[] args ) 
  {
    double[] array =  { -47.39, 24.96, -1.02, 3.45, 14.21, 32.6, 19.42 } ;

    // declare and initialize the total
        total =       ;

    // add each element of the array to the total
    for ( int index=0; index < array.length; index++ )
    { 

      total =     ;

    }
      
    System.out.println("The total is: " + total );
  }
}      

QUESTION 13:

Complete the program by filling in the blanks.