# Solved: Grading Schema: Write a program that reads a student’s name ….

\$30.00

Category:

## Description

Solved: Grading Schema: Write a program that reads a student’s name ….

In a separate function, you will implement a grading schema. Write a program that reads a student’s name together with his or her test score from a file given by the user. The first two values in the file will represent the number of students followed by the number of tests. The program should then compute the average test score for each student and assign the appropriate grade (A, B, C, D, E or F) as well as the average of each test. Your program must perform the following functions. a) A void function calculateAverage, to determine the average of the test scores for each student. b) A value-returning function, calculateGrade, to determine and return each student’s grade letter. c) A void function calculateTestAvg that calculates the average of all tests and overall average of students. d) A void function printGrades that prints the grades values, average marks and grade letter followed by the average of all tests and students.

Output:

Having problems calling a 2D arrary in order to print the average, grade and test average in printGrade. Also not sure if my second calculateTestAverage is correct either. Help with my code would be fantastic.

import java.io.IOException;

import java.util.ArrayList;

/**

*

* @author Jarvis

*/

private static final String FILENAME2 = “/Users/Jarvis/Documents/Students.txt”;

public static void main(String[] args) {

String students [] = new String;

int [][] grades = new int ;

String[] words;

String sCurrentLine;

int counter=0;

double [] row = new double ;

int [] tests = new int ;

try {

while ((sCurrentLine = br.readLine()) != null) {

words = sCurrentLine.split(” “);

students[counter]=words;

System.out.printf(students+ ” “);

for (int i=1; i < words.length; i++){

} //end of outer for loop

} // end of while loop

} catch (IOException e) {

e.printStackTrace();

} // end of catch

counter++;

}//end of main

public static void calculateAverage (int [] grades){

//calculate the average of each student

int sum = 0;

for (int i=0; i < grades.length; i++) {

// Divides the sum of the numbers by the number of grades

} // end of inner for loop

for(int j = 0; j < grades.length; j++) {

} // end of for loop

} // end of calculateAverage()

public static void calculateTestAverage (double [] row){

//calculate the average of each test

int sum = 0;

for (int i=0; i < row.length; i++) {

sum += row[i];

// Divides the sum of the numbers by the number of grades

double total = ((sum/(double)row.length));

} // end of inner for loop

for(int j = 0; j < row.length; j++) {

System.out.print(row[j]+” “);

}

} // end of calculateTestAverage method

return ‘F’;

return ‘D’;

return ‘C’;

return ‘B’;

return ‘A’;

} // end of calculateGrade method

} // end of method printGrades