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

A code that will determine the average of the class and display it. I have this

ID: 3906894 • Letter: A

Question

A code that will determine the average of the class and display it. I have this so far to go with my class.

import java.io.*;
  
public class TestAverages{
public static void main ( String[] args ) throws IOException {
  
double average;
int studentNumber = 1;
int getAverage;
  
TestScoreReader scoreReader = new TestScoreReader( "Grades.csv" );
  
while( scoreReader.readNextLine()){
  
average = scoreReader.getAverage();
  
System.out.println( " Average for student " + studentNumber + " is " + average );
  
studentNumber++;
  
average= getAverage;
average = ( studentNumber++ / 5 );


System.out.printf( "The average of the class is: ");
  
}
  
scoreReader.close();
System.out.println( " No more scores. " );
  

  
}
}

Explanation / Answer

import java.io.File; import java.io.IOException; import java.util.Scanner; public class TestScoreReader { private Scanner fin; private String line; public TestScoreReader(String fileName) throws IOException { fin = new Scanner(new File(fileName)); } public boolean readNextLine() { if(fin.hasNextLine()) { line = fin.nextLine(); return true; } else { return false; } } public double getAverage() { double total = 0; String[] words = line.split(","); for(int i = 0; i
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