-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathuni.java
More file actions
42 lines (38 loc) · 1.12 KB
/
uni.java
File metadata and controls
42 lines (38 loc) · 1.12 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
import java.util.Scanner;
import java.util.*;
public class uni {
public static void main(String args[]){
Scanner scn = new Scanner(System.in);
int studentsCount = scn.nextInt();
TreeSet<student> studentsTreeSet = new TreeSet<>();
for (int i=0 ; i < studentsCount ; i++){
String name = scn.next();
int id = scn.nextInt();
double gpa = scn.nextDouble();
student student=new student(name, id , gpa);
studentsTreeSet.add(student);
}
}
public static student searchId(int Id, TreeSet<student> studentsTreeSet){
student st = new student("john", 00, 0.00);
for (student i : studentsTreeSet){
if (i.id == Id){
st = i;
}
}
return st;
}
public static void printInfo(student st){
System.out.println("name :" + st.name+ "Id : "+ st.id+"gpa :" + st.gpa);
}
}
class student {
String name;
int id;
double gpa;
public student(String name , int id , double gpa){
this.name=name;
this.id=id;
this.gpa = gpa;
}
}