/**
*
* ArrayTest.java
*
* Revisions: 1.0 Sep. 02, 2002
* Created the ArrayTest class
* 1.1 Sep. 02, 2002
* Compiled, Tested, Coding Done
* 1.2 Sep. 05, 2002
* Thanks to a failed WinXP SP1 Install, had to recomment
*
*
*
* Collaboration Statement:
* I worked on the homework assignment alone, using only
* course materials.
*
* Created with JCreatorLE, some indents are off when viewed through notepad
* or EMACS
*
* @author Jose Manuel Caban
* @version Version 1.2, Sep. 05, 2002
*/
public class ArrayTest {
public static final boolean bDebug = false;
//////////////////
//from Phase III//
//////////////////
///////////
//Methods//
///////////
/**
*Loop through array and return sum
*@return sum of array elements
*/
public int sum(int intArray[]){
int sum = 0;
if(bDebug){
System.out.println("Begin iteration sum");
}
//function code
for(int i=0;i max){
max = intArray[i];
}
if(intArray[i] < min){
min = intArray[i];
}
} //end for loop
if(bDebug){
System.out.println("End iteration bounds");
}
int bounds[] = new int[2];
bounds[0] = min;
bounds[1] = max;
return bounds;
} //end bounds(int intArray[])
/********************************************************/
/////////////////
//From Phase IV//
/////////////////
///////////
//Methods//
///////////
/**
*Traverse through twoDArray
*@return the sum of the elements of twoDArray
*/
public static int sum(int twoDArray[][]){
int sum=0;
if(bDebug){
System.out.println("Begin iteration sum(twoDArray)");
}
for(int row=0; row
* @param args a String array of command line arguments.
*/
public static void main(String[] args) {
//////////////////
//from Phase III//
//////////////////
//////////////////
//test Phase III//
//////////////////
ArrayTest arraytest = new ArrayTest();
//test sum()
int[] array = new int[10];
for(int i = 0; i