Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Student
- {
- private int studentId;
- private int creditHours;
- private int pointsEarned;
- private int gradePointAverage;
- public int getStudentId()
- {
- return studentId;
- }
- public void setStudentId(int student)
- {
- studentId = student;
- }
- public int getCreditHours()
- {
- return creditHours;
- }
- public void setCreditHours(int credit)
- {
- creditHours = credit;
- }
- public int getPointsEarned()
- {
- return pointsEarned;
- }
- public void setPointsEarned(int points)
- {
- pointsEarned = points;
- }
- public int getGradePointAverage()
- {
- return gradePointAverage;
- }
- public void setGradePointAverage(int gradePointAverage)
- {
- gradePointAverage = gradePointAverage;
- }
- public static void gradePointAverage(int pointsEarned, int creditHours)
- {
- double gradePointAverage;
- gradePointAverage = pointsEarned/creditHours;
- System.out.println("your gpa is " + gradePointAverage);
- }
- }
- public class ShowStudent
- {
- public static void main(String[] args)
- {
- Student studentOne = new Student();
- studentOne.setStudentId(213);
- studentOne.setPointsEarned(12);
- studentOne.setCreditHours(3);
- studentOne.gradePointAverage(12, 3);
- //studentOne.setGradePointAverage(gradePointAverage);
- System.out.println("The students number is "
- + studentOne.getStudentId() + ".");
- System.out.println("The points earned is " +
- studentOne.getPointsEarned() + ".");
- System.out.println("The credit hours is " +
- studentOne.getCreditHours() + ".");
- System.out.println("The students grade point average is "
- + studentOne.getGradePointAverage() + ".");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement