PLEASE MODIFY MY CODE TO COMPUTE FOR THE AVERAGE OF FIRST GRADING, SECOND GRADING, THIRD GRADING AND FOURTH GRADING PERIOD, THE FORMULA IS THIS
AVERAGE COMPUTATION
First Grading Period:
Average = Sum of grades / Number of subjects
Second Grading to Fourth Grading Period:
Average = (30% of the Average of the previous grading period) + (70% of the Average of the current grading period)
//THIS IS MY CODE:
import java.io.*;
public class TestCase2 {
public static void main(String[] args)throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
float[][] arr = new float[4][5];
float ave = 0;
String[] outData = {"First", "Second", "Third", "Fourth"};
String studentName, gradeLevel;
int ctr = 0;
System.out.print("Enter name: ");
studentName = in.readLine();
System.out.print("Grade level: ");
gradeLevel = in.readLine();
for(int i=0; i<4; i++) {
float sum = 0;
int c = 0;
String[] inData = {"first", "second", "third", "fourth", "fifth"};
System.out.println();
System.out.println("============================");
System.out.println("Enter " + outData[ctr] + " Grading Grades ");
System.out.println("============================");
ctr++;
for(int j=0; j<5; j++) {
System.out.print("Enter " + inData[c] + " grade: ");
c++;
sum += arr[i][j] = Float.parseFloat(in.readLine());
}
//ave = sum / 5;
//System.out.print("Grading Period Average: " + ave + "n" + "n");
}
System.exit(0);
}
}