-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
34 lines (27 loc) · 1.03 KB
/
Student.java
File metadata and controls
34 lines (27 loc) · 1.03 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
import java.util.Date;
public class Student {
private String prn; // Unique ID for each student
private String name;
private Date dob;
private double marks;
// Constructor to initialize student details
public Student(String prn, String name, Date dob, double marks) {
this.prn = prn;
this.name = name;
this.dob = dob;
this.marks = marks;
}
// Getter and Setter methods for encapsulation
public String getPRN() { return prn; }
public void setPRN(String prn) { this.prn = prn; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public Date getDOB() { return dob; }
public void setDOB(Date dob) { this.dob = dob; }
public double getMarks() { return marks; }
public void setMarks(double marks) { this.marks = marks; }
// Method to display student details
public void displayStudent() {
System.out.println("PRN: " + prn + ", Name: " + name + ", DOB: " + dob + ", Marks: " + marks);
}
}