-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCollectionIter.java
More file actions
115 lines (90 loc) · 2.11 KB
/
CollectionIter.java
File metadata and controls
115 lines (90 loc) · 2.11 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import java.util.*;
import java.util.LinkedList;
class Coll {
public static void main(String args[]) throws Exception {
Scanner sc = new Scanner(System.in);
List<Student> stud = new LinkedList<>();
String ch = "y";
/*
* stud.add(new Student(101, "Sid", "Kulk"));
* stud.add(new Student(102, "avin", "uti"));
* stud.add(new Student(103, "jack", "tak"));
* stud.add(new Student(104, "Tim", "Dou"));
*
* System.out.println("Student ID\tFname\tLname");
* for(Student s:stud){
* System.out.println(" "+s.getId()+"\t\t"+s.getFname()+"\t"+s.getLname());
* }
*/
do {
System.out.println("Student Database Options: ");
System.out.println("1) Add Student Record");
System.out.println("2) Search Student Record");
System.out.println("3) Remove Student Record");
System.out.println("4) Edit Student Record");
int c = sc.nextInt();
switch (c) {
case 1: {
System.out.print("Enter Student ID: ");
int id = sc.nextInt();
System.out.println();
System.out.print("Enter Student First Name: ");
String fname = sc.nextLine();
System.out.println();
System.out.print("Enter Student Last Name: ");
String lname = sc.nextLine();
System.out.println();
}
break;
case 2: {
}
break;
case 3: {
}
break;
case 4: {
}
break;
case 5: {
System.exit(0);
}
break;
default: {
}
}
System.out.println("Do you want to continue?(y/n): ");
ch = sc.nextLine();
} while (ch.equals("y"));
}
}
/*
* STUDENT POJO
*/
class Student {
private int Id;
private String fname;
private String lname;
Student(int id, String fname, String lname) {
Id = id;
this.fname = fname;
this.lname = lname;
}
void setId(int id) {
this.Id = id;
}
void setFname(String fname) {
this.fname = fname;
}
void setLname(String lname) {
this.lname = lname;
}
int getId() {
return Id;
}
String getFname() {
return fname;
}
String getLname() {
return lname;
}
}