forked from utkarsh-shekhar/basic-programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
46 lines (39 loc) · 1007 Bytes
/
Student.java
File metadata and controls
46 lines (39 loc) · 1007 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
public class Student {
//MARK: Instance Variables
private String studentMajor;
private String firstName;
private String lastName;
private int studentCredits;
private double studentGPA;
//MARK: Constructors
public Student(String fName, String lName) {
this.firstName = fName;
this.lastName = lName;
this.studentMajor = "General Studies";
this.studentGPA = 0;
this.studentCredits = 0;
}
public Student(String major, int credits, double points, String fName, String lName) {
this.studentMajor = major;
this.studentCredits = credits;
this.studentGPA = points;
this.firstName = fName;
this.lastName = lName;
}
//MARK: Getters and Setters
public String getStudentMajor() {
return studentMajor;
}
public String getFullName() {
return firstName + " " + lastName;
}
public int getStudentCredits() {
return studentCredits;
}
public double getStudentGPA() {
return studentGPA;
}
public void ChangeMajor(String newMajor) {
this.studentMajor = newMajor;
}
}