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

This question has been posted 4 times in two days. If you\'ve already attempted

ID: 644626 • Letter: T

Question

This question has been posted 4 times in two days. If you've already attempted it, you were wrong and move along. Stop wasting my

time with error filled answers. It MUST run in Eclipse Luna error free.

Create a class named Student. Student 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. 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. Save this class as Student.java

Write a class named ShowStudent that instantiates a Student object from the class you created and assigns values to its fields. Compute the Student grade point average, and then display all the values associated with the Student. Save the application as ShowStudent.java

Explanation / Answer

Java Program:

public final class Student{

private int id, hours, points;
private double GPA;

public void setID( int n ){ id = n; }
public void setHours( int n ){ hours = n; }
public void setPoints( int n ){ points = n; }
public void setGPA( double d ){ GPA = d; }

public int getID(){ return id; }
public int getHours(){ return hours; }
public int getPoints(){ return points; }
public double getGPA(){ return GPA; }

Student(){
id = 9999;
GPA = 4.0;
hours = 0;
points = 0;
}

public String toString(){
StringBuffer b = new StringBuffer();
b.append( "id : " );
b.append( id );
b.append( " hours : " );
b.append( hours );
b.append( " points : " );
b.append( points );
b.append( " GPA : " );
b.append( GPA );
b.append( " " );

return b.toString();
}
}

Student2.java
Code:
public final class Student2{

public static void main( String[] args ){
System.out.println( new Student() );
}
}

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