So for part of an assignment i have I have to tell if a student is elgiable for a scholarship if their gpa is above a 3.0 but I'm confused as to how I would do it? Here's my array in main
Student[] student = new Student[3]; //create the array of students
student[0] = new Student("Tom", "Cooper", 3.5, "EE", "Junior");
student[1] = new Student("Annie", "Todd", 2.3, "CS", "Sophomore");
student[3] = new Student("Luis", "Rodriguez", 3.8, "INFO", "Sophomore");
and then I have a student class file that contains the constructor
public Student(String firstName, String lastName, double gpa, String major, String year) {
this.firstName = firstName;
this.lastName = lastName;
this.gpa = gpa;
this.major = major;
this.year = year;
}
public void setgpa(double gpa) {
this.gpa = gpa;
}
public double getgpa() {
return gpa;
}
So for my output I want just those who have above a 3.0, I'm assuming I would need a for loop but not exactly sure how it would specifically check their gpa for eligibility or if I do it within the main or the class?