i am very new to Java (1st semester). The assignment is to return the location of the largest element in a 2-diamensional array by using this method <public static int[] locatelargest(double[][] a).
I have worked on this program for almost a week and have eliminated all but the following two '.class expected' errors.
Please any information and/or help is appreciated.
import java.util.Scanner; // Scanner is in the java.util package
public class testTwoDiaArray {
/**Main Method*/
public static void main(String[] args) {
java.util.Scanner input = new java.util.Scanner(System.in);
//have user enter the number of rows and columns to be processed
System.out.println("Enter the number of rows and columns of the array");
int r = input.nextInt();
int c = input.nextInt();
System.out.println("rows: " + r + " cols: " + c);
//get and store the number of rows and cols
double[][] rowCol = new double[r][c];
double[][] a = new double[r][c];
System.out.println("Enter the array");
for (int rows = 0; rows < rowCol.length; rows++) {
for (int cols = 0; cols < rowCol[rows].length; cols++) {
rowCol[rows][cols] = input.nextDouble();
int[] result = locateLargest(double[][] a);
System.out.println("The location of the largest element is at (" + a[0] + ", " + a[1] + "0");
}
}
}
public static int[] locateLargest(double[][] a) {
double largest;
largest = 0;
for (int lrow = 0; lrow < a.length; lrow++) {
System.out.println("a length is " + a.length);
for (int lcol = 0; lcol < a[lrow].length; lcol++) {
if (a[lrow][lcol] > largest) largest = a[lrow][lcol];
}
}
return result;
}
}