//this is given
public class Student {
private String name;
private String address;
private String phone;
private String major;
String[ ] classesTaken = new String[100];
double[ ] gradesReceived = new double[ 100];
public void addClassesTaken(String classID) {}
public void addGradeReceived(float classGrade) {}
public void changeGradesReceived(String classID,
double newGrade) {}
public void computeGPA( ) {}
}
I need to....
1 - randomly fill the gradesReceived array with random variables between 1 and 100
2 - populate the classesTaken array with empty strings
3 - have the computeGPA method throw a DivideByZeroException if no grades are entered
4 - rewrite the code below to include try, catch, and finally blocks
public double computeGPA () {
double sum = 0.0;
for (int i = 0; i <100; I++) {
if (!classesTaken.equals(" ")) {
sum += gradesReceived;
}
}
return sum / (double)i;
}
5 - the catch block should should print out an error message (nonGUI) and return zero as the GPA , and the finally block should print out a message (nonGUI) indicating the method finished
6 - write a main method that instantiates an object of the student class and calls the computeGPA method