Respuesta :
/****************
* Student.java *
****************/
public class Student
{
int sid;
int credithours;
int points;
double averagegrade;
// constructor to assign initial values
public Student() {
this.sid = 9999;
this.credithours = 3;
this.points = 12;
}
// methods to assign values to all fields.
public void setCredithours(int credithours) {
this.credithours = credithours;
}
public void setPoints(int points) {
this.points = points;
}
public void setSid(int sid) {
this.sid = sid;
}
// method to compute the grade point average field by dividing points by credit hours earned.
public void computeAveragegrade()
{
this.averagegrade = this.points / this.credithours;
}
// methods to display the values in each Student field
public void showSid(){
System.out.println("Student id is : " + this.sid);
}
public void showPoints(){
System.out.println("Number of points earned : " + this.points);
}
public void showCredithours(){
System.out.println("Number of credit hours earned : " + this.credithours);
}
public void showAveragegrade(){
System.out.println("Average grade point is : " + this.averagegrade);
}
}