Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The gradeRecord class maintains student records for the registrar. Its attribute

ID: 3883900 • Letter: T

Question


The gradeRecord class maintains student records for the registrar. Its attributes include the string studentID, along with integers for the units (total number of units attempted and gradepts (total grade points earned). These data members can be used to compute the gpa of the student by using the formula gpa = double (gradepts)/units: The foregoing figure represents an object named studObj. The gpa, computed by the object, is 3.45. Describe the gradeRecord class as an ADT. The operations include gpa(), which computes and returns the GPA, and updateGradeInfo(), which takes new units and grade points as arguments and updates the grade record. The operation writeGrade-Info outputs the current status of the grade record in the following format: Student: 783-29-4716 Units: 100 GradePts: 345 GPA: 3.45

Explanation / Answer

class StudObj {

  

   private String studentID;

   private int units;

   private int gradepts;

   public String getStudentID() {

       return studentID;

   }

   public void setStudentID(String studentID) {

       this.studentID = studentID;

   }

   public int getUnits() {

       return units;

   }

   public void setUnits(int units) {

       this.units = units;

   }

   public int getGradepts() {

       return gradepts;

   }

   public void setGradepts(int gradepts) {

       this.gradepts = gradepts;

   }

   public StudObj(String studentID, int units, int gradepts) {

       super();

       this.studentID = studentID;

       this.units = units;

       this.gradepts = gradepts;

   }

  

  

}

public class GradeRecord {

   StudObj student;

   public GradeRecord(StudObj student) {

       super();

       this.student = student;

   }

   public double gpa() {

       double d = student.getUnits();

       double gpa = student.getGradepts()/d;

       return gpa;

   }

  

   public void updateGradeInfo(int units, int gradepts){

       this.student.setUnits(units);

       this.student.setGradepts(gradepts);

   }

  

   public void writeGradeInfo(){

       System.out.println("Student:" + this.student.getStudentID() +" Units:" + this.student.getUnits() + " GradePts:"+ this.student.getGradepts() + " GPA:" + this.gpa());

   }

  

   public static void main(String[] args) {

       StudObj stud = new StudObj("783-29-4716", 100,345);

       GradeRecord grdRcd = new GradeRecord(stud);

       grdRcd.writeGradeInfo();

      

   }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote