Han

Han Ferik

Home | Projects | AP CSA

Project StudentGPA

Tools: VSCode | Source Code: GitHub

The StudentGPA program evaluates whether a student is eligible for an award based on their GPA, attendance, and honor status. This program is encapsulated within the StudentGPA class, which has four private instance variables: studentGPA, studentAttendance, studentHonorStatus, and studentReward. The studentGPA variable stores the student's grade point average, while studentAttendance records the percentage of attendance. The studentHonorStatus boolean indicates whether the student is on the honor roll, and studentReward signifies if the student qualifies for the award.

In the constructor of the StudentGPA class, the student's GPA, attendance, and honor status are initialized. This allows the program to create instances of students with specific academic attributes. The primary functionality lies in the isEligibleForAward() method, which determines eligibility based on two criteria: the student's GPA must be 3.7 or higher, or the student must be on the honor roll, and their attendance must be at least 90%. If these conditions are met, studentReward is set to true; otherwise, it is set to false.

The main method serves as the entry point of the program, where an instance of StudentGPA is created with a GPA of 3.8, attendance of 95%, and honor status set to true. The program then calls the isEligibleForAward() method and prints the result, indicating whether the student qualifies for the award.

Overall, this program demonstrates essential object-oriented programming concepts in Java, including class design, object instantiation, and method implementation. It also highlights the use of conditional statements to evaluate multiple criteria for eligibility, showcasing how boolean logic is applied to determine outcomes. This project reinforces the understanding of encapsulation and illustrates effective code structuring to manage student data and eligibility assessments.


Student GPA

Student GPA in Java


		public class StudentGPA {
		    private double studentGPA;
		    private int studentAttendance;
		    private boolean studentHonorStatus;
		    private boolean studentReward;
		
		    public StudentGPA(double GPA, int attendance, boolean honorStatus) {
		        this.studentGPA = GPA;
		        this.studentAttendance = attendance;
		        this.studentHonorStatus = honorStatus;
		    }
		
		    public boolean isEligibleForAward() {
		        if ((studentGPA >= 3.7 || studentHonorStatus) && studentAttendance >= 90) {
		            studentReward = true;
		        } else {
		            studentReward = false;
		        }
		        return studentReward;
		    }
		
		    public static void main(String[] args) {
		        StudentGPA student = new StudentGPA(3.8, 95, true);
		        System.out.println(student.isEligibleForAward());
		    }       
		}
		    

Find me on the interwebs!

Github LinkedIn Instagram Facebook