The variables are well named and self explanatory. For indentation please find the attached screenshots.
package gradebook;
import java.io.*;
import java.util.*;
class Student{
String name;
Double[] testScores;
Double avgScore;
Character grade;
Student(String name){
this.name = name;
testScores = new Double[4];
}
public String getName(){
return name;
}
public Double getAvgScore(){
return avgScore;
}
public Character getGrade(){
return grade;
}
public void setScores(Double a,Double b,Double c,Double d){
testScores[0]=a;
testScores[1]=b;
testScores[2]=c;
testScores[3]=d;
avgScore = (a+b+c+d)/4;
if(avgScore<=59 && avgScore>=0){
grade = ‘F’;
}
else if(avgScore<=69){
grade = ‘D’;
}
else if(avgScore<=79){
grade = ‘C’;
}
else if(avgScore<=89){
grade = ‘B’;
}
else if(avgScore<=100){
grade = ‘A’;
}
}
}
class Batch{
ArrayList<Student> studentList;
Batch(){
studentList = new ArrayList<Student>();
}
public void addStudent(Student obj){
studentList.add(obj);
}
public void showRecords(){
for(Student obj:studentList){
System.out.println(obj.getName()+” “+obj.getAvgScore()+” “+obj.getGrade());
}
}
}
public class GradeBook {
public static void main(String[] args) throws IOException {
Batch A = new Batch();
Student obj;
String name;
Double score1,score2,score3,score4;
BufferedReader inp = new BufferedReader (new InputStreamReader(System.in));
for(int i=0;i<5;i++){
System.out.println(“Enter student name “+(i+1));
name = inp.readLine();
System.out.println(“Enter testScore 1”);
score1 = Double.parseDouble(inp.readLine());
while(score1<0 || score1>100){
System.out.println(“Invalid score”);
System.out.println(“Enter testScore 1 again”);
score1 = Double.parseDouble(inp.readLine());
}
System.out.println(“Enter testScore 2”);
score2 = Double.parseDouble(inp.readLine());
while(score2<0 || score2>100){
System.out.println(“Invalid score”);
System.out.println(“Enter testScore 2 again”);
score2 = Double.parseDouble(inp.readLine());
}
System.out.println(“Enter testScore 3”);
score3 = Double.parseDouble(inp.readLine());
while(score3<0 || score3>100){
System.out.println(“Invalid score”);
System.out.println(“Enter testScore 3 again”);
score3 = Double.parseDouble(inp.readLine());
}
System.out.println(“Enter testScore 4”);
score4 = Double.parseDouble(inp.readLine());
while(score4<0 || score4>100){
System.out.println(“Invalid score”);
System.out.println(“Enter testScore 4 again”);
score4 = Double.parseDouble(inp.readLine());
}
obj = new Student(name);
obj.setScores(score1, score2, score3, score4);
A.addStudent(obj);
}
A.showRecords();
}
}
![eclipse-workspace gradebook/src/gradebook/GradeBook.java - Eclipse IDE 1, 9(100%) ) 2:26 PM * | Quick Access | :|哈 唸 D GradeBookjava X 2 package gradebook; 4 import java.io. 5 import java.util. 7 class Student String name; Doubletl testScores; Double avgScore; Character grade; 10 12 13 Student (string name) 14 15 16 17 18 19e public String getName) this.name name; testScores -new Doublel4] return name; 21 23e public Double getAvgScore) 24 25 26 27 public Character getGrade) return avgScore return grade; 29 30 31e public void setScores (Double a,Double b,Double c,Double d)t 32 testscores [b]=a; testScores[11-b testscores [21-c testScores [3] d 34 35 36 37 38 39 avgScore(a+b+c+d)/4; if(avgScorec 59 && avgScore>-e){ grade F 41 42 43 else if (avgScore-69) qrade D Writable Smart Insert 135:1](https://media.cheggcdn.com/media%2Fe36%2Fe3641971-d5f6-482a-a32d-4dbef72d900f%2Fphpz8H64R.png)





Hope this helps, Please upvote if you feel satisfied.
Thank you 🙂