-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinkedList_Basic_studentData.java
More file actions
55 lines (44 loc) · 1.11 KB
/
Copy pathLinkedList_Basic_studentData.java
File metadata and controls
55 lines (44 loc) · 1.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
import java.util.LinkedList;
import java.util.Scanner;
class Student {
String name;
int age;
float marks;
Student(String name, int age, float marks) {
this.name = name;
this.age = age;
this.marks = marks;
}
}
public class LinkedList_Basic_studentData {
static Scanner sn = new Scanner(System.in);
static void display(LinkedList<Student> ll) {
if (ll.isEmpty()) {
System.out.println("LinkedList is EMPTY!!!");
return;
}
System.out.println(ll);
}
static void inputStudent(LinkedList<Student> ll) {
System.out.println("Enter Student details : ");
String n = sn.next();
int a = sn.nextInt();
float m = sn.nextFloat();
Student s = new Student(n, a, m);
ll.add(s);
}
static void remove(LinkedList<Student> ll, Student s) {
if ((ll.isEmpty()) || (ll.contains(s) == false)) {
System.out.println("Input Student Unavailable");
return;
} else
ll.remove(s);
display(ll);
}
static int count(LinkedList<Student> ll) {
return ll.size();
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}