Question
1. No change in the Student class 2. Change in the StudentList class to read the data from a file named StudentGrades.txt which contains the
1. No change in the Student class
2. Change in the StudentList class to read the data from a file named StudentGrades.txt which contains the following data (instead of hard-coding the data)
Edna
57 74 73 85 86 65 99
Edmund
75 61 94 53 68 76 73
Sadie
49 69 67 80 99 78 70
Olive
88 87 42 62 44 81 46
Dianna
76 100 98 60 72 94 99
Roderick
81 70 29 53 72 1 18
Cameron
84 1 5 21 10 27 93
Rafael
96 4 97 67 37 44 34
Isaac
68 57 45 40 25 83 63
Darla
76 6 1 17 35 12 38
Renee
59 34 22 54 50 80 28
Neil
40 100 49 93 42 86 9
Carmen
9 72 35 85 17 22 34
Cecelia
3 96 24 10 96 31 91
Kerry
4 49 53 31 31 87 90
public class Student { private String name; private int[] testScores; private double average; private String letterGrade; //-------------------------------------------------- public Student(String name, int[] testScores) { this.name = name; this.testScores = testScores; Grader g = new Grader(); average = g.getAverageGrade(testScores); letterGrade = g.grade(testScores); } //-------------------------------------------------- public String getScoreString() { return java.util.Arrays.toString(testScores); } //-------------------------------------------------- public String getName() { return name; } //-------------------------------------------------- public int[] getTestScores() { return testScores; } //-------------------------------------------------- public double getAverage() { return average; } //-------------------------------------------------- public String getLetterGrade() { return letterGrade; } } //======================================================================== public class StudentList { //-------------------------------------------------- private Student[] studentList; private String[] names = {"Edna", "Edmund", "Sadie", "Olive", "Dianna" }; private int[][] testScores = { {57, 74, 73, 85, 86, 65, 99 }, {75, 61, 94, 53, 68, 76, 73 }, {49, 69, 67, 80, 99, 78, 70 }, {88, 87, 42, 62, 44, 81, 46 }, {76, 100, 98, 60, 72, 94, 99 }}; //-------------------------------------------------- public StudentList() { studentList = new Student[names.length]; for (int k = 0; k < names.length; k++) { studentList[k] = new Student(names[k], testScores[k]); } } //-------------------------------------------------- public Student findStudent(String name) { for (int k = 0; k < studentList.length; k++) { if (name.equals(studentList[k].getName())) return studentList[k]; } return null; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started