public class Student implements Cloneable
1: public class Student implements Cloneable {
2:
3: public Student(String ID, String firstName, String lastName, String streetAddress, String state, String city, String country, String postalCode, String telephone, float GPA, int totalCredits) {
4: this.ID = ID;
5: this.firstName = firstName;
6: this.lastName = lastName;
7: this.streetAddress = streetAddress;
8: this.state = state;
9: this.city = city;
10: this.country = country;
11: this.postalCode = postalCode;
12: this.telephone = telephone;
13: this.GPA = GPA;
14: this.totalCredits = totalCredits;
15: }
16:
17: public Student(String ID, String firstName, String lastName, String streetAddress, String state, String city, String country, String postalCode, String telephone, float GPA) {
18: this.ID = ID;
19: this.firstName = firstName;
20: this.lastName = lastName;
21: this.streetAddress = streetAddress;
22: this.state = state;
23: this.city = city;
24: this.country = country;
25: this.postalCode = postalCode;
26: this.telephone = telephone;
27: this.GPA = GPA;
28: }
29:
30: public Student(String ID, String firstName, String lastName, String streetAddress, String state, String city, String country, String postalCode, String telephone, int totalCredits) {
31: this.ID = ID;
32: this.firstName = firstName;
33: this.lastName = lastName;
34: this.streetAddress = streetAddress;
35: this.state = state;
36: this.city = city;
37: this.country = country;
38: this.postalCode = postalCode;
39: this.telephone = telephone;
40: this.totalCredits = totalCredits;
41: }
42:
43: public Student(String ID, String firstName, String lastName, String streetAddress, String state, String city, String country, String postalCode, String telephone) {
44: this.ID = ID;
45: this.firstName = firstName;
46: this.lastName = lastName;
47: this.streetAddress = streetAddress;
48: this.state = state;
49: this.city = city;
50: this.country = country;
51: this.postalCode = postalCode;
52: this.telephone = telephone;
53: }
54:
55: public Object clone()
56: throws CloneNotSupportedException {
57: return super.clone();
58: }
59:
60: public boolean equals(Object other) {
61: if ((other != null) && (other instanceof Student)) {
62: Student o = (Student) other;
63: if (totalCredits != o.totalCredits)
64: return false;
65: if (GPA != o.GPA)
66: return false;
67: if ((telephone == null && o.telephone != null) || (telephone != null) && (!(telephone.equals(o.telephone))))
68: return false;
69: if ((postalCode == null && o.postalCode != null) || (postalCode != null) && (!(postalCode.equals(o.postalCode))))
70: return false;
71: if ((country == null && o.country != null) || (country != null) && (!(country.equals(o.country))))
72: return false;
73: if ((city == null && o.city != null) || (city != null) && (!(city.equals(o.city))))
74: return false;
75: if ((state == null && o.state != null) || (state != null) && (!(state.equals(o.state))))
76: return false;
77: if ((streetAddress == null && o.streetAddress != null) || (streetAddress != null) && (!(streetAddress.equals(o.streetAddress))))
78: return false;
79: if ((lastName == null && o.lastName != null) || (lastName != null) && (!(lastName.equals(o.lastName))))
80: return false;
81: if ((firstName == null && o.firstName != null) || (firstName != null) && (!(firstName.equals(o.firstName))))
82: return false;
83: if ((ID == null && o.ID != null) || (ID != null) && (!(ID.equals(o.ID))))
84: return false;
85: return true;
86: } else {
87: return false;
88: }
89: }
90:
91: public String getCity() {
92: return city;
93: }
94:
95: public String getCountry() {
96: return country;
97: }
98:
99: public String getFirstName() {
100: return firstName;
101: }
102:
103: public float getGPA() {
104: return GPA;
105: }
106:
107: public String getID() {
108: return ID;
109: }
110:
111: public String getLastName() {
112: return lastName;
113: }
114:
115: public String getPostalCode() {
116: return postalCode;
117: }
118:
119: public String getState() {
120: return state;
121: }
122:
123: public String getStreetAddress() {
124: return streetAddress;
125: }
126:
127: public String getTelephone() {
128: return telephone;
129: }
130:
131: public int getTotalCredits() {
132: return totalCredits;
133: }
134:
135: public void setCity(String city) {
136: this.city = city;
137: }
138:
139: public void setCountry(String country) {
140: this.country = country;
141: }
142:
143: public void setFirstName(String firstName) {
144: this.firstName = firstName;
145: }
146:
147: public void setGPA(float GPA) {
148: this.GPA = GPA;
149: }
150:
151: public void setID(String ID) {
152: this.ID = ID;
153: }
154:
155: public void setLastName(String lastName) {
156: this.lastName = lastName;
157: }
158:
159: public void setPostalCode(String postalCode) {
160: this.postalCode = postalCode;
161: }
162:
163: public void setState(String state) {
164: this.state = state;
165: }
166:
167: public void setStreetAddress(String streetAddress) {
168: this.streetAddress = streetAddress;
169: }
170:
171: public void setTelephone(String telephone) {
172: this.telephone = telephone;
173: }
174:
175: public void setTotalCredits(int totalCredits) {
176: this.totalCredits = totalCredits;
177: }
178:
179: public String toString() {
180: StringBuffer s = new StringBuffer();
181: s.append("Student [");
182: s.append("totalCredits=");
183: s.append(totalCredits);
184: s.append("; ");
185: s.append("GPA=");
186: s.append(GPA);
187: s.append("; ");
188: s.append("telephone=");
189: s.append(telephone);
190: s.append("; ");
191: s.append("postalCode=");
192: s.append(postalCode);
193: s.append("; ");
194: s.append("country=");
195: s.append(country);
196: s.append("; ");
197: s.append("city=");
198: s.append(city);
199: s.append("; ");
200: s.append("state=");
201: s.append(state);
202: s.append("; ");
203: s.append("streetAddress=");
204: s.append(streetAddress);
205: s.append("; ");
206: s.append("lastName=");
207: s.append(lastName);
208: s.append("; ");
209: s.append("firstName=");
210: s.append(firstName);
211: s.append("; ");
212: s.append("ID=");
213: s.append(ID);
214: s.append("]");
215: return s.toString();
216: }
217:
218: protected int totalCredits;
219:
220: protected float GPA;
221:
222: protected String telephone;
223:
224: protected String postalCode;
225:
226: protected String country;
227:
228: protected String city;
229:
230: protected String state;
231:
232: protected String streetAddress;
233:
234: /** The last name of the student */
235: protected String lastName;
236:
237: /** The first name of the student */
238: protected String firstName;
239:
240: /** The ID of the student */
241: protected String ID;
242:
243:
244: }