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

Write a program that read the given file StudentScores.txt. Store the scores for

ID: 3826600 • Letter: W

Question

Write a program that read the given file StudentScores.txt. Store the scores for each student in an array (this should be done automatically by the program).Your program will calculate the following results and display the results on the screen. The highest number in the array
Write a program that read the given file StudentScores.txt. Store the scores for each student in an array (this should be done automatically by the program).Your program will calculate the following results and display the results on the screen. The highest number in the array

Explanation / Answer

/* You have not described any language hence i am doing this in JAVA */


import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Chegg_read {
   public static void main(String[] args) throws IOException {
  
   //reading the file StudentScores.txt
       FileReader file = new FileReader("StudentScores.txt");
     
//creating arraylist
   List<Integer> temparray = new ArrayList<Integer>();
   //storing student scores in arraylist
   try {
Scanner input = new Scanner(file);
while(input.hasNext())
{
temparray.add(input.nextInt());
  
}
input.close();
}
catch(Exception e)
{
e.printStackTrace();
}
     
   //max variable to store highest number
int max=temparray.get(0);
/* loop to find the highest number */
   for(int i=0;i<temparray.size();i++){
       if(max<=temparray.get(i))
           max=temparray.get(i);
   }
   System.out.println("The highest number in the array : "+max);//printing highest number
   }
}

/* Content of the StudentScores.txt
10
20
35
15
17
*/
/* OUTPUT
The highest number in the array : 35
*/

/* Note:Please do ask in case of any doubt,thanks,god bless you */

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote