|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectStudent
public class Student
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. A student may also have a picture.
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 |
|
Student(String delimString,
String nameDelim,
String gradeDelim)
Constructor that takes a delimited string, the name delimiter, and the grade delimiter. |
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 |
Picture |
getPicture()
Method to get the picture for 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 |
void |
setPicture(Picture thePicture)
Method to set the picture for this student |
void |
show()
Method to show this student It will display the picture if there is one else just print the student name |
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 |
---|
public Student()
public Student(String theName)
theName
- the student's namepublic Student(String theName, double[] theGradeArray)
theName
- the student's nametheGradeArray
- the array of gradespublic Student(String delimString, String nameDelim, String gradeDelim)
delimString
- student information as a
delimited stringnameDelim
- what delimits the name field
from the gradesgradeDelim
- what delimits the gradesMethod Detail |
---|
public Picture getPicture()
public void setPicture(Picture thePicture)
thePicture
- the picture to usepublic void show()
public String getName()
public boolean setName(String theName)
theName
- the new name to use
public double getGrade(int index)
index
- the index that we want the grade for
public boolean setGradeArray(double[] theArray)
theArray
- the new array of grades to use
public boolean setGrade(int index, double newGrade)
index
- the index to set it atnewGrade
- the grade to use
public double getAverage()
public String toString()
toString
in class Object
public static void main(String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |