Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Class Student

    java.lang.Object
      Student

    public class Student

extends Object

Class that describes a student. A student has a name and an array of grades. You can get information about a student such as her/his name and grade average.

Author:
  Barb Ericson ericson@cc.gatech.edu

Constructor Summary
`Student()` No argument constructor.
`Student(String theName)` Constructor that takes the name
`Student(String theName, double[] theGradeArray)` Constructor that takes the name and an array of grades

Method Summary
`double` | `getAverage()` Method to return the average of the grades for this student
`double` | `getGrade(int index)` Method to get the grade in the grade array at the passed index
`String` | `getName()` Method to return the name of this student
`static void` | `main(String[] args)`
`boolean` | `setGrade(int index, double newGrade)` Method to set a grade at an index
`boolean` | `setGradeArray(double[] theArray)` Method to replace the array of grades
`boolean` | `setName(String theName)` Method to set the name for this student
`String` | `toString()` Method to return a string with information about this student

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Student

    public Student()

  No argument constructor. Leaves all fields with default values

### Student

    public Student(String theName)

  Constructor that takes the name

  Parameters:
    `theName` - the student's name

### Student

    public Student(String theName,
                   double[] theGradeArray)

  Constructor that takes the name and an array of grades

  Parameters:
    `theName` - the student's name
    `theGradeArray` - the array of grades

Method Detail

### getName

    public String getName()

  Method to return the name of this student

  Returns:
    the student's name

### setName

    public boolean setName(String theName)

  Method to set the name for this student

  Parameters:
    `theName` - the new name to use
  Returns:
    true if success else false

### getGrade

    public double getGrade(int index)

  Method to get the grade in the grade array at the passed index

  Parameters:
    `index` - the index that we want the grade for
  Returns:
    the grade in the grade array at this passed index

### setGradeArray

    public boolean setGradeArray(double[] theArray)

  Method to replace the array of grades

  Parameters:
    `theArray` - the new array of grades to use
  Returns:
    true if sucess, else false

### setGrade

    public boolean setGrade(int index,
                            double newGrade)

  Method to set a grade at an index

  Parameters:
    `index` - the index to set it at
    `newGrade` - the grade to use
  Returns:
    true if success else false

### getAverage

    public double getAverage()

  Method to return the average of the grades for this student

  Returns:
    the average of the grades or 0.0 if no grade array or no grades

### toString

    public String toString()

  Method to return a string with information about this student

  Overrides:
    `toString` in class `Object`
  Returns:
    a string with information about the student

### main

    public static void main(String[] args)

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD