I'm writing a class program for a pre-wrote driver. I'm having issues accessing the array variables from the driver. I know my problem is that my setProject is trying to take my array as an argument, but the specification calls for two ints(array index, array index value). But I'm not sure how to code it as such. I've searched, but I think I'm missing something totally obvious. Just looking for some direction.
public class Student { //Begin the Student Class
//Declared private variables
private String studentName;
private String studentEmail;
private String studentLocation;
private int[] project;
private int[] quizGrades;
private int finalExam;
private int participationGrade;
private double finalGrade;
private int sum;
private int sum1;
public void setStudentName (String newName){
studentName = newName;
}
public String getName(){
return studentName;
}
public void setStudentLocation (String newLocation){
studentLocation = newLocation;
}
public String getLocation(){
return studentLocation;
}
public void setStudentEmail (String newEmail){
studentEmail = newEmail;
}
public String getEmail(){
return studentEmail;
}
public double setProject(int[] newProject){
project = newProject [4];
int sum1 = 0;
for (int i=0; i<=4; i++)
sum1 = sum1 + project[i];
}
public int [] getProject(){
return project;
}
public void setQuizGrades(int [] newQuizGrades){
quizGrades = newQuizGrades[2];
int sum = 0;
for (int i=0; i<=2; i++)
sum = sum + quizGrades[i];
}
public int [] getQuizGrades(){
return quizGrades;
}
public void setFinalExam (int newFinalExam){
finalExam = newFinalExam;
}
public int getFinalExam(){
return finalExam;
}
public void setParticipationGrade (int newParticipationGrade){
participationGrade = newParticipationGrade;
}
public int setParticipationGrade(){
return participationGrade;
}
public void setFinalGrade(double newFinalGrade){
finalGrade = ((sum1/10) + (sum/20) + (finalExam + participationGrade/4));
}
public double setFinalGrade(){
return finalGrade;
}
public void studentReport(){
System.out.println("------------------------------------------------");
System.out.println("Student " + studentName);
System.out.println("Location " + studentLocation);
System.out.println("Contact information " + studentEmail);
System.out.println("Grade Report");
System.out.println("------------------------------------------------");
System.out.println("Quiz 1 " + quizGrades[1]);
System.out.println("Quiz 2 " + quizGrades[2]);
System.out.println("Project 1 " + project[1]);
System.out.println("Project 2 " + project[2]);
System.out.println("Project 3 " + project[3]);
System.out.println("Project 4 " + project[4]);
System.out.println("Participation " + participationGrade);
System.out.println("Final Exam " + finalExam);
System.out.println("------");
System.out.println("Final Grade: " + finalGrade);
}
}