Hi I know you can easily find the error here, and i need help to fix this out I'm very tired to find what's wrong with my code,I'm trying to fix it out but it becomes complicate when im trying to change something
here's my currently code:
package copro;
public class QuizInherit {
public static void main(String[] args){
students persons[] = new students[3];
persons[0] = new students("Vincent","Dimalanta",90,85,80);
persons[1] = new students("Daryl", "De Guzman", 95, 92, 91);
persons[2] = new students("Jayson", "Elizaga", 88, 87, 86);
for (students person : persons) {
person.print();
}
}
public class students extends Calculations {
private String firstname;
private String lastname;
public students(String firstname, String lastname, int Grade1,
int Grade2, int Grade3) {
super(Grade1, Grade2, Grade3);
this.firstname = firstname;
this.lastname = lastname;
}
public void print() {
System.out.println("FirstName: " + firstname);
this.print();
System.out.println("LastName: " + lastname);
this.print();
this.getAve();
}
}
public class Calculations {
private int Grade1;
private int Grade2;
private int Grade3;
private double ave;
public Calculations(int Grade1, int Grade2, int Grade3) {
this.Grade1 = Grade1;
this.Grade2 = Grade2;
this.Grade3 = Grade3;
this.ave = ave;
}
public void getAve() {
ave = (Grade1 + Grade2 + Grade3) / 3;
}
public void print() {
System.out.println("Student Details: ");
this.print();
System.out.println("Grade1: " + Grade1);
System.out.println("Grade2: " + Grade2);
System.out.println("Grade3: " + Grade3);
System.out.println("The average is: " + ave);
}
}
}
The error is here:
persons[0] = new students("Vincent","Dimalanta",90,85,80);
I hope you will help me, I know this is very easy question but Its hard for me because I'm currently beginner to the Programming World
Thank you