-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUgrad.java
More file actions
29 lines (25 loc) · 860 Bytes
/
Ugrad.java
File metadata and controls
29 lines (25 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
public class Ugrad extends Student {
private int level; //1 = fresh, 2 = soph, 3 = jun, 4 = sen, 5 = supersenior
//Enum advised ^
public Ugrad() {//Default constructor
super();
this.level = 1;
}//Ugrad
public Ugrad(String aName, int anID, int aLevel) {//Parameterized Constructor
super(aName, anID);
this.level = this.setLevel(aLevel);
}//Ugrad parameterized
public int getLevel() {//Accessor
return this.level;
}//getLevel
public void setLevel(int anID) {//Mutator
if(aLevel >= 1 && aLevel <= 5) {
this.level = aLevel;
}//if
}//setLevel
public boolean equals(Ugrad anUgrad) {
return anUgrad != null && //redundant again, the next statement will go all the way to person.equals method and return false
super.equals(anUgrad) &&
this.level == anUgrad;
}//equals
}//Ugrad