
how to add student and mark and number from file in linked list and print them also how to make search function plz can help me sooon

import java.util.*;
class StudentData{
int id;
String name;
int marks;
StudentData(int id,String name,int marks){
this.id=id;
this.name=name;
this.marks=marks;
}
public int getId(){
return id;
}
public String getName(){
return name;
}
public int getMarks(){
return marks;
}
public static void main(String[] args){
int count=0;
LinkedList<StudentData> list=new LinkedList<StudentData>();
Scanner input=new Scanner(System.in);
for(int i=0;i<5;i++){
System.out.print("Enter ID: ");
int id=input.nextInt();
System.out.print("Enter Name: ");
String name=input.next();
System.out.print("Enter Marks: ");
int m=input.nextInt();
list.add(new StudentData(id,name,m));
}
for(StudentData data:list){
if(data.getMarks()>=60){
count++;
}
}
System.out.println("Number of students obtained 60 or above: "+count);
System.out.print("Enter id to display record: ");
int rec=input.nextInt();
for(StudentData data:list){
if(data.getId()==rec){
System.out.println(data.getId()+"\t"+data.getName()+"\t"+data.getMarks());
}
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.