Any help would really be appreciated, majorly stuck at this problem it simply wont run i am at a lost point, the criteria is :
Write a program that returns the sum of all elements in a specified column of a two-dimensional array.
Firstly ask the user to enter a 3 by 4 array. The user should enter the array as follows: 2.6 5.1 6 8 5.4 4.4 7 1 9.5 7.9 2 3
The program should then calculate the sum of each column in the array.
Tried casting to double or ints nothing works
package com.company;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
double[] Array1 = new double[5];
double[] Array2 = new double[5];
boolean Equal = true;
Scanner input = new Scanner(System.in);
System.out.print("Please enter " + Array1.length + " values");
for (int i = 0; i < Array1.length; i++) {
Array1[i] = input.nextDouble();
}
Scanner input2 = new Scanner(System.in);
System.out.print("Please enter " + Array2.length + " values for your second array:");
for (int i = 0; i < Array2.length; i++)
Array2[i] = input.nextDouble();
if(Array1.length == Array2.length)
{
for (int i = 0; i < Array1.length; i++)
{
if(Array1[i] != Array2[i])
{
Equal = false;
}
}
}
else
{
Equal = false;
}
if (Equal)
{
System.out.println("Two Arrays Are Equal");
}
else
{
System.out.println("Two Arrays Are Not equal");
}
}
}