|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectStudent
public class Student
Represents a student with a name and several test scores
Field Summary | |
---|---|
static int |
MAX_SCORE
The maximum score (100) |
static int |
MIN_SCORE
The minimum score (0) |
Constructor Summary | |
---|---|
Student()
Default: name is "" and each of 3 scores is 0 |
|
Student(java.lang.String nm)
Name is nm and each of 3 scores is 0 |
|
Student(java.lang.String nm,
int n)
Name is nm and each of n scores is 0 |
|
Student(java.lang.String nm,
int[] t)
Name is nm and the scores are taken from array t |
|
Student(Student s)
Builds a copy of a student |
Method Summary | |
---|---|
int |
getAverage()
|
int |
getHighScore()
|
java.lang.String |
getName()
|
int |
getScore(int i)
|
void |
setName(java.lang.String nm)
Changes the studentŐs name |
void |
setScore(int i,
int score)
|
java.lang.String |
toString()
|
java.lang.String |
validateData()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static int MIN_SCORE
public static int MAX_SCORE
Constructor Detail |
---|
public Student()
public Student(java.lang.String nm)
nm
- the name of the studentpublic Student(java.lang.String nm, int n)
nm
- the name of the studentn
- is the number of scores, each 0public Student(java.lang.String nm, int[] t)
nm
- the name of the studentt
- an array of test scorespublic Student(Student s)
s
- the student to be copiedMethod Detail |
---|
public void setName(java.lang.String nm)
nm
- the new namepublic java.lang.String getName()
public void setScore(int i, int score)
i
- the ithscore
- the ith score
java.lang.IllegalArgumentException
- if i < 1 or i > number of scores
java.lang.IllegalArgumentException
- if score < MIN_SCORE or score > MAX_SCOREpublic int getScore(int i)
i
- the ith
java.lang.IllegalArgumentException
- if i < 1 or i > number of scorespublic int getAverage()
public int getHighScore()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String validateData()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |