
Untitled
By: a guest on Jan 28th, 2012 | syntax:
None | size: 1.11 KB | hits: 17 | expires: Never
// The "AddingArrays" class.
// Dave Tsinovoy
// January 28th, 2012
//@param first the first list (array) of numbers
//@param second the second list (array) of numbers
import java.awt.*;
import hsa.Console;
public class AddingArrays
{
static Console c; // The output console
static int[] addArrays (int[] first, int[] second)
{
if (first.length > second.length)
{
for (int i = 0 ; i < first.length ; i++)
{
int[] newArray = new int [first.length];
newArray [i] = first [i] + second [i];
}
return newArray;
}
else
{
for (int i = 0 ; i < second.length ; i++)
{
int[] newArray = new int [second.length];
newArray [i] = first [i] + second [i];
}
return newArray;
}
}
public static void main (String[] args)
{
c = new Console ();
// Place your program here. 'c' is the output console
} // main method
} // AddingArrays class