The problem I have is at line 21, which is input[Weeks][Results] = scanner.nextDouble();
.
I dont know what I'm doing wrong. The program just basically ask me for how many weeks i want to input and how many results per week and then store them in a 2d array.
package com.company;
import java.sql.SQLOutput;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("How many weeks?: ");
int Weeks = scanner.nextInt();
System.out.print("How many results per week?: ");
int Results = scanner.nextInt();
double[][] input = new double[Weeks][Results];
for (int i = 0; i < Weeks; i++) {
System.out.println("Temperature Week " + Weeks + ": ");
for (int k = 0; k < Results; k++) {
input[Weeks][Results] = scanner.nextDouble();
}
}
}
}