/**
 * sectCode7.java - based on Dan's Code11.java
 * Jp LaFond
 * CS E-76
 *
 */

// A simple program for printing a few arrays
// Adding a helper class

class sectCode7 {
    private static class Student {
	public String name;
	public double grade;

	public Student(String name, double grade) {
	    this.name  = name;
	    this.grade = grade;
	}

	// Don't really need the getters/setters, but I'm thorough
	public String setName(String name) {
	    this.name = name;
	    return name;
	}

	public double setGrade(double grade) {
	    this.grade = grade;
	    return grade;
	}

	public String getName() {
	    return name;
	}

	public double getGrade() {
	    return grade;
	}
    }

    public static void main(String[] args) {

	// Declare the arrays
	Student[] myClass;

	// Allocate the memory for 5 indices
	myClass = new Student[5];

	// Assign values
	myClass[0] = new Student("Abe Abbott", 100.0);
	myClass[1] = new Student("Bob Baker",   76.2);
	myClass[2] = new Student("Carol Chase", 92.13);
	myClass[3] = new Student("Doug Davidson", 95.4);
	myClass[4] = new Student("Ed Evans", 14.92);

	for (int i = 0, loopMax = myClass.length;
	     i < loopMax;
	     i++) {
	    // Bug i+1 doesn't result in (i+1) but the value of i with
	    // a 1 after it.
	    System.out.println ("[" + i+1 + "](" + myClass[i] + ")");
	}
    }
}