Hi I need help with writing code! So I have to write java code that 1. tells if two arrays are equal or not (same values in the same index position) 2. If they are not the same then we want to know how many values are differing and the largest difference between two values.
Here are the two arrays:
double[] Array1 = {10.2, 2.7, 6.4};
double[] Array2 = {5.7, 4.0, 2.7};
This is what I've done and tried so far it might be wrong so please tell me the right solution and how to continue solving the problem:
for (i=0; i<Array1.length; i++) {
for( i=0; j<Array2.length; j++) {
if (Array1 [i] == Array2 [j]) {
System.out.println ("Arrays are equal");
}
else {
if (Array1 [i] != Array2 [j] ) {
System.out.println ("Arrays are not equal" );