Convert this Student Array code into Student Singly LinkedList using java. public class Student { static int index=0; int sid; String name; String date; char attendence; static Student[] stdarry=new Student[10]; public void insert(int id, String nm, String dt, char att) { stdarry[index]=new Student(); stdarry[index].sid=id; stdarry[index].name=nm; stdarry[index].date=dt; stdarry[index].attendence=att; index++; } public int search(int id) { int check=0; for(int i=0 ;i

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Convert this Student Array code into Student Singly LinkedList using java.

public class Student {
static int index=0;
int sid;
String name;
String date;
char attendence;

static Student[] stdarry=new Student[10];

public void insert(int id, String nm, String dt, char att)
{
stdarry[index]=new Student();
stdarry[index].sid=id;
stdarry[index].name=nm;
stdarry[index].date=dt;
stdarry[index].attendence=att;
index++;

}
public int search(int id)
{
int check=0;
for(int i=0 ;i<index; i++)
{
if(stdarry[i].sid==id)
{
check=i;
break;
}
}
return check;
}
public void display()
{

for(int i=0 ;i<index;i++)
{
System.out.println("ID ="+stdarry[i].sid+"| Name ="+stdarry[i].name+"| Date ="
+stdarry[i].date+"| Attendence ="+stdarry[i].attendence);


}
}

public void UpdateAttendence( int id, String dt, char att)
{
for(int i=0; i<index ;i++)
{
if(stdarry[i].sid==id && stdarry[i].date==dt)
{

stdarry[i].attendence=att;
break;
}
}
}
public void showPresentStudent(String dt, char status) {
int count = 0;
System.out.println("Present Student Are:");
for(int i=0;i<index;i++) {

if( stdarry[i].attendence==status) {

System.out.println("ID:"+stdarry[i].sid+"|Name:"+stdarry[i].name);
count++;
}
}
}
public void checkAttendence(int newId) {
for(int i=0;i<index;i++) {
if(stdarry[i].sid==newId) {
System.out.println("Check Attendence of given ID="+stdarry[i].attendence);
}
}

}
public void TodayAttendenceSummary(String dt) {
int countP=0;
int countA=0;
System.out.println("Today Attendence Summary:");
for(int i=0;i<index;i++) {
if(stdarry[i].date==dt) {
if(stdarry[i].attendence=='P'){
countP++;
}
if(stdarry[i].attendence=='A'){
countA++;
}
}
}
System.out.println("Present Students are:"+countP+"\nAbsent Student are:"+countA);
}
public void MarkAttendence(int id, String dt, char att) {

for(int i=0;i<index;i++) {

}

}
}

class StudentData
{
public static void main(String[] args) {
Student stdobj=new Student();


stdobj.insert(101,"Umer","3-06-2021",'P');
stdobj.insert(102,"Umer","3-06-2021",'A');
stdobj.insert(103,"Ali","3-06-2021",'P');
stdobj.insert(104,"Ali","3-06-2021",'A');
stdobj.UpdateAttendence(102,"3-06-2021",'P');
stdobj.showPresentStudent("3-06-2021",'P');
stdobj.checkAttendence(102);
stdobj.TodayAttendenceSummary("3-06-2021");
stdobj.display();
}


}

Expert Solution
steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY