Есть класс Student и его дочерний класс Aspirant в обоих классах есть метод scholarship
В классе Main пытаюсь обратиться к методу scholarship, но IntelliJ IDEA не позволяет это сделать.
подскажите почему
public class Student {
private String firstName;
private String lastName;
private String group;
private double averageMark;
public Student(String firstName, String lastName, String group, double averageMark) {
this.firstName = firstName;
this.lastName = lastName;
this.group = group;
this.averageMark = averageMark;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String getGroup() {
return group;
}
public double getAverageMark() {
return averageMark;
}
public static void scholarship(Student... students){
for (Student student: students) {
if(student.getAverageMark() == 5.00)
System.out.println("100");
System.out.println("80");
}
}
}
public class Aspirant extends Student{
private String scientificWork;
private String firstName;
private String lastName;
@Override
public double getAverageMark() {
return averageMark;
}
private String group;
private double averageMark;
public Aspirant(String scientificWork, String firstName, String lastName, String group, double averageMark) {
super(firstName, lastName, group, averageMark);
this.scientificWork = scientificWork;
}
public static void scholarship(Aspirant... Aspirants){
for (Aspirant aspirant : Aspirants) {
if(aspirant.getAverageMark() == 5.00)
System.out.println("200");
System.out.println("180");
}
}
}
public class Main {
public static void main(String[] args) {
Student student1 = new Student("Ivan", "Mutko", "KGB", 5);
Student aspirant1 = new Aspirant("UFO", "Alex", "Petrov", "NASA", 4.75);
Student student2 = new Student("Berik", "Pivovarov", "NATO", 3);
Student aspirant2 = new Aspirant("SUP", "Serik", "Belyy", "OON", 5);
Student[] students = {student1, student2, aspirant1, aspirant2};
scholarship(students);
System.out.println();
}
}