Advertisement
Guest User

showStudent

a guest
Oct 31st, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.79 KB | None | 0 0
  1. public class Student
  2. {
  3.    private int studentId;
  4.    private int creditHours;
  5.    private int pointsEarned;
  6.    private int gradePointAverage;
  7.    
  8.    public int getStudentId()
  9.    {
  10.       return studentId;
  11.    }
  12.    public void setStudentId(int student)
  13.    {
  14.       studentId = student;
  15.    }
  16.    
  17.    public int getCreditHours()
  18.    {
  19.       return creditHours;
  20.    }
  21.    public void setCreditHours(int credit)
  22.    {
  23.       creditHours = credit;
  24.    }
  25.    
  26.    public int getPointsEarned()
  27.    {
  28.       return pointsEarned;
  29.    }
  30.    public void setPointsEarned(int points)
  31.    {
  32.       pointsEarned = points;
  33.    }
  34.    
  35.    public int getGradePointAverage()
  36.    {
  37.       return gradePointAverage;
  38.    }
  39.    public void setGradePointAverage(int gradePointAverage)
  40.    {
  41.       gradePointAverage = gradePointAverage;
  42.    }
  43.    
  44.    public static void gradePointAverage(int pointsEarned, int creditHours)
  45.    {
  46.       double gradePointAverage;
  47.       gradePointAverage = pointsEarned/creditHours;
  48.       System.out.println("your gpa is " + gradePointAverage);
  49.    }
  50. }
  51.  
  52.  
  53.  
  54. public class ShowStudent
  55. {
  56.    public static void main(String[] args)
  57.    {
  58.       Student studentOne = new Student();
  59.       studentOne.setStudentId(213);
  60.       studentOne.setPointsEarned(12);
  61.       studentOne.setCreditHours(3);
  62.       studentOne.gradePointAverage(12, 3);
  63.       //studentOne.setGradePointAverage(gradePointAverage);
  64.    
  65.       System.out.println("The students number is "
  66.       + studentOne.getStudentId() + ".");
  67.       System.out.println("The points earned is " +
  68.       studentOne.getPointsEarned() + ".");
  69.       System.out.println("The credit hours is " +
  70.       studentOne.getCreditHours() + ".");
  71.       System.out.println("The students grade point average is "
  72.       + studentOne.getGradePointAverage() + ".");
  73.    }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement