-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReportCard.java
More file actions
67 lines (63 loc) · 1.42 KB
/
ReportCard.java
File metadata and controls
67 lines (63 loc) · 1.42 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
public class ReportCard {
//variables to be stored
String Firstname;
String Lastname;
int TUid;
String Email;
String PhoneNum;
String Major;
int ExpGrad;
String Grad;
public ReportCard(String Firstname, String Lastname, int TUid, String Email, String PhoneNum, String Major, int ExpGrad, String Grad) {
this.Firstname = Firstname;
this.Lastname = Lastname;
if (ValidTUid(TUid)){
this.TUid = TUid;
}else {
this.TUid = -1;
}
this.Email = Email;
//Method for checking is string is integer by parsing. It is a class called quality control afterall
try {
Integer.parseInt(PhoneNum);
if(PhoneNum.length() == 9) {
this.PhoneNum = PhoneNum;
}else { this.PhoneNum = "-1"; }
}catch(NumberFormatException e) {
this.PhoneNum = "-1";
}
//Going from int to String is much different than String to Int
this.Major = Major;
this.ExpGrad = ExpGrad;
this.Grad = Grad;
}
boolean ValidTUid(int TUid){
String StringTUid = Integer.toString(TUid);
return StringTUid.length() == 9;
}
//bunch of getter methods
public String getFirstName() {
return Firstname;
}
public String getLastName() {
return Lastname;
}
public int getTUid() {
return TUid;
}
public String getEmail() {
return Email;
}
public String getPhoneNum() {
return PhoneNum;
}
public String getMajor() {
return Major;
}
public int getExpGrad() {
return ExpGrad;
}
public String getGrad() {
return Grad;
}
}