-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudent.java
153 lines (134 loc) · 2.64 KB
/
Student.java
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
public class Student // service class
{
// static fields
private static String classNumber;
private static String className;
private static String instructor;
static int studentCount = 1000; // counter used for studentId
// instance fields
private int studentId;
private String firstName;
private String lastName;
private String address;
private String city;
private String state;
private String email;
// constructor #1
Student(String first, String last)
{
firstName = first;
lastName = last;
studentId = studentCount;
studentCount++; // increment count
}
// constructor #2
Student(String first, String last, String address, String city, String state, String email)
{
this(first, last);
this. address = address;
this.city = city;
this.state = state;
this.email = email;
}
// STATIC getter/setter methods
// classNumber
static String getClassNumber() // getter
{
return(classNumber);
}
static void setClassNumber(String classNum) // setter
{
classNumber = classNum;
}
// className
static String getClassName() // getter
{
return(className);
}
static void setClassName(String classNa) // setter
{
className = classNa;
}
//instructor
static String getInstructor() // getter
{
return(instructor);
}
static void setInstructor(String in)
{
instructor = in;
}
// INSTANCE getter/setter methods
// studentId
int getStudentId() //getter
{
return(studentId);
}
// no studentId setter needed, generated by constructors
// firstName
String getFirstName() // getter
{
return(firstName);
}
void setFirstName(String fName) // setter
{
firstName = fName;
}
// lastName
String getLastName() // getter
{
return(lastName);
}
void getLastname(String lName) // setter
{
lastName = lName;
}
// address
String getAddress() // getter
{
return(address);
}
void setAddress(String a) // setter
{
address = a;
}
// city
String getCity() // getter
{
return(city);
}
void setCity(String c) // setter
{
city = c;
}
// state
String getState() // getter
{
return(state);
}
void setState(String s) // setter
{
state = s;
}
// email
String getEmail() // getter
{
return(email);
}
void setEmail(String e) // setter
{
email = e;
}
// toString() method
public String toString()
{
String data = "Student Name: " + firstName + " " + lastName + "\n" +
"Student I.D.: " + studentId + "\n" +
"Class Name: " + className + "\n" +
"Instructor Name: " + instructor + "\n" +
"Class Number: " + classNumber + "\n" +
"Student Address: " + address + ", " + city + ", " + state + "\n" +
"Student Email Address: " + email;
return(data);
}
}