-
Notifications
You must be signed in to change notification settings - Fork 687
Expand file tree
/
Copy pathStudent.java
More file actions
47 lines (38 loc) · 1.28 KB
/
Student.java
File metadata and controls
47 lines (38 loc) · 1.28 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
public class Student {
private String name;
private int studentId;
private int numberOfCredits = 0;
private double gpa = 0.0;
// Drop your getters and setters below for the Student class.
// To instantiate the Student class, add your code to the main in the file, SchoolPractice.
public void setName(String name) {
this.name = name;
}
public void setStudentId(int studentId) {
this.studentId = studentId;
}
public void setGpa(double gpa) {
this.gpa = gpa;
}
private void setNumberOfCredits(int numberOfCredits) {
this.numberOfCredits = numberOfCredits;
}
public String getName() {
return name;
}
public int getStudentId() {
return studentId;
}
public int getNumberOfCredits() {
return numberOfCredits;
}
public double getGpa() {
return gpa;
}
Student student = new Student("Your Name", 12345, 1, 4.0);
public class Course {
private String topic;
private Teacher instructor;
private ArrayList<Student> enrolledStudents;
}
}