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

Create a class named Student that has fields for an ID number, number of credit

ID: 3755590 • Letter: C

Question

Create a class named Student that has fields for an ID number, number of credit hours earned, and number of points earned. (For example, many schools compute grade point averages based on a scale of 4, so a three-credit-hour class in which a student earns an A is worth 12 points.) Include methods to assign values to all fields. A Student also has a field for grade point average. Include a method to compute the grade point average field by dividing points by credit hours earned. Write methods to display the values in each Student field.

Use class named ShowStudent that instantiates a Student object to test your class. Compute the Student grade point average, and then display all the values associated with the Student.

Create a constructor for the Student class you created. The constructor should initialize each Student’s ID number to 9999, his or her points earned to 12, and credit hours to 3 (resulting in a grade point average of 4.0). Write a program that demonstrates that the constructor works by instantiating an object and displaying the initial values.

I have tried all the solutions and they all have errors. Paying for a subscription and still not getting help is not good business.  

Explanation / Answer

Since you have not mentioned the language of your preference, I am providing the code in Java.

CODE

========================

Student.java

****************************

public class Student {

   private int id;

   private int numCredits;

   private int numPoints;

  

   private double gradeAverage;

   public Student(int id, int numCredits, int numPoints) {

       this.id = id;

       this.numCredits = numCredits;

       this.numPoints = numPoints;

   }

   /**

   * @return the id

   */

   public int getId() {

       return id;

   }

   /**

   * @param id the id to set

   */

   public void setId(int id) {

       this.id = id;

   }

   /**

   * @return the numCredits

   */

   public int getNumCredits() {

       return numCredits;

   }

   /**

   * @param numCredits the numCredits to set

   */

   public void setNumCredits(int numCredits) {

       this.numCredits = numCredits;

   }

   /**

   * @return the numPoints

   */

   public int getNumPoints() {

       return numPoints;

   }

   /**

   * @param numPoints the numPoints to set

   */

   public void setNumPoints(int numPoints) {

       this.numPoints = numPoints;

   }

  

   public void computeAverageGrade() {

       gradeAverage = (double) (numPoints / numCredits);

   }

  

   public double getAverageGrade() {

       return gradeAverage;

   }

   /* (non-Javadoc)

   * @see java.lang.Object#toString()

   */

   @Override

   public String toString() {

       return "Student [ID = " + id + ", Number of Credits Hours earned = " + numCredits + ", Number of Points earned = " + numPoints + "]";

   }

}

ShowStudent.java

****************************

public class ShowStudent {

   public static void main(String args[]) {

       Student student = new Student(9999, 3, 12);

       student.computeAverageGrade();

      

       System.out.println(student);

      

       System.out.println("Student ID : " + student.getId());

       System.out.println("Number of credit hours earned = " + student.getNumCredits());

       System.out.println("Number of point earned = " + student.getNumPoints());

       System.out.println("Student grade point average = " + student.getAverageGrade());

   }

}

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