ann.math.DoubleArrays

DoubleArrays.java is a module that defines classwide operations for arrays of double values.

 

 

public static double [] readArray()

Read values from the Keyboard into an array

Precondition: Keyboard contains an int n, followed by n double values.

Input: the values from Keyboard

Return: the n input values in a double array

 

public static double sum(double [] array)

Sum the values in an array of doubles

Receive: double [] array

Return: the sum of the values in array

 

public static double average(double [] array)

Find the average of the values in an array of doubles

Receive: double [] array

Precondition: array.length > 0.

Return: the average of the values in array

 

public static boolean equals(double [] a1, double [] a2)

Check two arrays for equality

Receive: double [] a1, double [] a2

Return: true iff a1 and a2 contain exactly the same elements

 

 


Back to the package documentation index


Back to the Introduction


Copyright 2000 by Prentice Hall. All rights reserved.