-bash-4.2$ ls -ld Student.java
-rw-r--r-- 1 dgerman www 1373 Sep 16 16:27 Student.java
-bash-4.2$ cat Student.java
public class Student {

  String name; // instance variable initially null

  double totalScore; // instance variable initially 0.0 (zero)
  int count; // instance variable initially 0 (zero)

  public Student(String name) { // constructor
    this.name = name; // take the value of the parameter store it
  }
  public String getName() {
    return this.name;
  }
  public void addQuiz(int score) {
    this.count += 1; // when I add a quiz score I keep track of the event (quiz)
    this.totalScore = this.totalScore + score;
  }
  public double getTotalScore() {
    return this.totalScore;
  }
  public double getAverageScore() {
    return this.totalScore / this.count; // 2.0 / 3
  }
  public static void main(String[] args) {
    Student a = new Student("Laura");
    System.out.println( "Student " + a + "'s name is: " +  a.getName() );
    a.addQuiz(89);
    a.addQuiz(97);
    a.addQuiz(91);
    System.out.println( a.getName() + "'s total score is: " + a.getTotalScore() ); // expected 277.0
    Student b = new Student("Blake");
    b.addQuiz(93);
    System.out.println( b.getName() + "'s total score is: " + b.getTotalScore() );
    System.out.println( a.getName() + "'s average score is: " + a.getAverageScore() ); // expected 92.3333...
    System.out.println( b.getName() + "'s average score is: " + b.getAverageScore() );
  }
}
-bash-4.2$ javac Student.java
-bash-4.2$ java Student
Student Student@4e25154f's name is: Laura
Laura's total score is: 277.0
Blake's total score is: 93.0
Laura's average score is: 92.33333333333333
Blake's average score is: 93.0
-bash-4.2$