Question: Can I please get help with this? import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Analyze { private List courseGrades; public

Can I please get help with this?

import java.io.File;

import java.io.FileNotFoundException;

import java.util.ArrayList;

import java.util.List;

import java.util.Scanner;

public class Analyze {

private List courseGrades;

public Analyze () {

courseGrades = new ArrayList();

}

public void readData (String fileName) throws FileNotFoundException {

Scanner s = new Scanner(new File(fileName));

s.nextLine();

while (s.hasNextLine()) {

String line = s.nextLine();

String[] data = line.split(",");

Professor p = new Professor(data[2]);

String course = data[0];

String department = course.substring(0, 4);

int courseNumber = Integer.valueOf(course.substring(4, 7));

char special = '\0';

if (course.length() == 8) {

special = course.charAt(7);

}

String section = data[1];

Course c = new Course (department, courseNumber, special, section);

CourseGrade cg = new CourseGrade(p, c);

cg.updateGrade("A+", Integer.valueOf(data[4]));

cg.updateGrade("A", Integer.valueOf(data[5]));

cg.updateGrade("A-", Integer.valueOf(data[6]));

cg.updateGrade("B+", Integer.valueOf(data[7]));

cg.updateGrade("B", Integer.valueOf(data[8]));

cg.updateGrade("B-", Integer.valueOf(data[9]));

cg.updateGrade("C+", Integer.valueOf(data[10]));

cg.updateGrade("C", Integer.valueOf(data[11]));

cg.updateGrade("C-", Integer.valueOf(data[12]));

cg.updateGrade("D+", Integer.valueOf(data[13]));

cg.updateGrade("D", Integer.valueOf(data[14]));

cg.updateGrade("D-", Integer.valueOf(data[15]));

cg.updateGrade("F", Integer.valueOf(data[16]));

cg.updateGrade("W", Integer.valueOf(data[17]));

cg.updateGrade("Other", Integer.valueOf(data[18]));

courseGrades.add(cg);

}

s.close();

}

public float getProfessorAverage (Professor p) {

throw new UnsupportedOperationException("Remove this line and replace with your implementation.");

}

public float getCourseAverage (Course c, boolean sectionOnly) {

throw new UnsupportedOperationException("Remove this line and replace with your implementation.");

}

public float getDepartmentAverage (String department) {

throw new UnsupportedOperationException("Remove this line and replace with your implementation.");

}

public List getProfessorsTeachingCourse (Course course) {

throw new UnsupportedOperationException("Remove this line and replace with your implementation.");

}

public List getProfessorsTeachingDepartment (String department) {

throw new UnsupportedOperationException("Remove this line and replace with your implementation.");

}Can I please get help with this? import java.io.File; import java.io.FileNotFoundException; importjava.util.ArrayList; import java.util.List; import java.util.Scanner; public class Analyze { private List courseGrades;

Constructors: A default constructor that initializes courseGrades to a new, empty ArrayList Methods: . void readData (String fileName) Note that this method has already been implemented. Do not modify it. This method reads the passed grades file, which you can assume exists and is a Comma-Separated Values (CSV) file. This means the data is separated by commas. The first row is a header row that shows how the data is ordered. Here are two rows from the file (the header row, and row #1925): Course,Section,Professor, Total,A+,A,A-,B+,B,B-,C+,C,c-,D+,D,D-,Fs,Withdraw,Other CMSC250,401,Roger D. Eastman,33,1,1,4,6,5,2,1,6,3,0,0,1,1,2,0 You can match these rows up. CMSC250 is the Course, 401 is the Section, Roger D. Eastman is the Professor, a total of 33 students received a grade,student received an A+, and so on Observe that the method reads through the file line-by-line and adds CourseGrades to gradesList after creating a Course and a Professor object for each row. It also sets the grades of a CourseGrade object from the grade data given in the row. Note that the number of students who received an Other" grade is also added to a CourseGrade object. If a course does not have a "special" character, the u character is assigned to special. This is done by setting, for example, char special-No, or char special-o. Once this method is completely executed, courseGrades will have all of the data from fileName . float getProfessorAverage (Professor p), which returns the average GPA a professor gave. Note that you should not calculate the average with a simple mean between the courses a professor teaches. The average should be weighted based on how many students took a course a professor taught. For example, suppose a professor teaches two courses: course A with 20 students and course B with 10 students. The average GPA in course A is a 3.53 and in course B is a 3.08. The average GPA should be calculated as (3.53 * 20) + (3.08 * 10) 20+ 10 = 3.38

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!