I have a program I am trying to write and I can not figure it out. I have to create a multi dimensional array and find the max and min values of the arrays. Here is my code;
and this is my error....import java.util.Scanner; import java.util.Arrays; public class Assign10_Key { public static void main(String[] args) { Scanner input = new Scanner(System.in); double[]midTerm1= new double [10]; for (int A = 0; A <midTerm1.length; A++){ System.out.println("Please enter MidTerm1 grade:"); midTerm1[A] = input.nextInt(); } System.out.println("Now"); double[]midTerm2=new double[10]; for(int B=0; B<midTerm2.length;B++){ System.out.println("Please enter a MidTerm2 grade:"); midTerm2[B] = input.nextInt(); } System.out.println("Now"); double[]finalExam = new double[10]; for(int C = 0; C<finalExam.length; C++){ System.out.println("Please enter a Final Exam grade:"); finalExam[C] = input.nextInt(); } int [] grades = new int [10]; int max = 0; for (int t = 0; t < grades.length; t ++) { if (grades[t] > max) { max = grades[t]; } int min = 0; if(grades[t] < min) { min = grades[t]; } } System.out.print("Your highest test score is: " + max); System.out.print("Your lowest test score is: " + min); System.out.print("You have entered following grades for midTerm1: "); System.out.println(Arrays.toString(midTerm1)); System.out.print("You have entered following grades for midTerm2: "); System.out.println(Arrays.toString(midTerm2)); System.out.print("You have entered following grades for Final Exam: "); System.out.println(Arrays.toString(finalExam)); } }
C:\Users\Penny\Desktop\CPT187\Assign10_Key.java:56 : cannot find symbol
symbol : variable min
location: class Assign10_Key
System.out.print("Your lowest test score is: " + min);
Could someone please help??
Thanks!