-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathStudentApplication.java
More file actions
51 lines (51 loc) · 1.36 KB
/
StudentApplication.java
File metadata and controls
51 lines (51 loc) · 1.36 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
package XayDungLop;
import java.util.Scanner;
class SinhVien {
private int id;
private String name;
private int GPA;
public SinhVien(int id, String name, int GPA) {
this.id = id;
this.name = name;
this.GPA = GPA;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getPGA() {
return GPA;
}
public void setPGA(int GPA) {
this.GPA = GPA;
}
public void display() {
System.out.println("Student ID: " + id);
System.out.println("Name : " + name);
System.out.println("GPA : " + GPA);
}
}
public class StudentApplication {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Nhập ID: ");
int id = sc.nextInt();
sc.nextLine();
System.out.print("Nhập tên: ");
String name = sc.nextLine();
System.out.print("Nhập điểm TBC: ");
int GPA = sc.nextInt();
SinhVien st = new SinhVien(id, name, GPA);
System.out.println("\n=== Thông tin sinh viên ===");
st.display();
sc.close();
}
}