Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am currently working on a coding project that has to do with 2 dimensional arr

ID: 3669481 • Letter: I

Question

I am currently working on a coding project that has to do with 2 dimensional arrays. I am having some trouble getting started on part 2. Some help on part two would be great.

Part 1: From scratch, create a program to… -Ask the user how many exams a student took in class -Define a single dimensional array to hold the exams scores, based on the number of exams -Using a ‘for’ loop, ask the user to input exam scores, storing inputted values in the array you created -Loop through the array and determine the high score, the low score, and the average of the exams -Display the values of the high and low score. -Display the student’s exam average (1 decimal)

Part 2: Now assume that the single student above is part of an entire class. -First, at the top of your program, ask the user how many students there are in the class -Ask the user how many exams were given in the class (same number for all students) -Declare a 2D array that is used to hold all of the scores read in, where number of rows = number of students in the class and number of columns = number of exams given -Read in EACH student’s exam score, store in the 2D array and display an exam average for each student (high score / low score is optional) -After all student scores have been read in, determine and display the highest and lowest exam scores from the entire class -Determine and display the class average (1 decimal)

Here is my code for part 1:

import java.util.*;
import java.text.DecimalFormat;


public class Lab4 {
   public static void main (String[]args){
       Scanner s = new Scanner(System.in);
       DecimalFormat df = new DecimalFormat("$#,###,###.0");
       String input;
       int numExams = 0;
       int highest;
       int lowest;
       double totalScores = 0;
       double avgGrade;
      
       System.out.print("How many exams were taken? ");
       numExams = Integer.parseInt(s.nextLine());
       int [] scores = new int[numExams];
      
       System.out.println("Enter the exam scores for " + numExams + " exams.");
      
       // get the exam scores
       for (int index = 0; index<numExams; index++)
       {
           System.out.print("Exam " + (index+1) + ": ");
           scores[index] = s.nextInt();
       }
      
       highest = scores[0];
       for (int index=1; index < scores.length; index++)
       {
           if (scores[index] > highest)
               highest = scores[index];
       }
      
       lowest = scores[0];
       for (int index=1; index < scores.length; index++)
       {
           if (scores[index] < lowest)
               lowest = scores[index];
              
       }
       System.out.println("Highest score: " + highest);
       System.out.println("Lowest score: " + lowest);
      
       for (int index = 0; index < scores.length; index++)
           totalScores += scores[index];
       avgGrade = totalScores / scores.length;
      
       System.out.printf("The average score is: %.1f", avgGrade);
      
  
   }

}

Explanation / Answer

This model program i have is to find the highest number among the 2D array.

To find the Lowest number in the array the following logic can be applied

This method can be applied to find the highest and lowest mark among the students