Complete the method “readdata”. In this method you are to read in at least 10 sets of student data into a linked list. The data to read in is: student id number, name, major (CIS or Math) and student GPA. You will enter data of your choice. You will need a loop to continue entering data until the user wishes to stop. Complete the method “printdata”. In this method, you are to print all of the data that was entered into the linked list in the method readdata. Complete the method “printstats”. In this method, you are to search the linked list and print the following: List of student’s id and names who are CIS majors List of student’s id and names who are Math majors List of student’s names along with their gpa who are honor students (gpa 3.5 or greater) All information for the CIS student with the highest gpa (you may assume that different gpa values have been entered for all students) CODE (student_list.java) You MUST use this code: package student_list; import javax.swing.JOptionPane; public class student_list { public static void main(String[] args) { student_data data=new student_data(); data.readdata(); data.printdata(); data.printstats(); System.exit(0); } } class student_data extends student_node { student_node first,current,previous; student_data() { //create a dummy first link first = new student_node(); first.next=null; previous=first; } void readdata() { } void printdata() { } void printstats() { } } class student_node { int stu_number; String stu_name; String major; double gpa; student_node next; }
Complete the method “readdata”. In this method you are to read in at least 10 sets of student data into a linked list. The data to read in is: student id number, name, major (CIS or Math) and student GPA. You will enter data of your choice. You will need a loop to continue entering data until the user wishes to stop.
Complete the method “printdata”. In this method, you are to print all of the data that was entered into the linked list in the method readdata.
Complete the method “printstats”. In this method, you are to search the linked list and print the following:
List of student’s id and names who are CIS majors
List of student’s id and names who are Math majors
List of student’s names along with their gpa who are honor students (gpa 3.5 or greater)
All information for the CIS student with the highest gpa (you may assume that different gpa values have been entered for all students)
CODE (student_list.java) You MUST use this code:
package student_list;
import javax.swing.JOptionPane;
public class student_list
{
public static void main(String[] args)
{
student_data data=new student_data();
data.readdata();
data.printdata();
data.printstats();
System.exit(0);
}
}
class student_data extends student_node
{
student_node first,current,previous;
student_data()
{
//create a dummy first link
first = new student_node();
first.next=null;
previous=first;
}
void readdata()
{
}
void printdata()
{
}
void printstats()
{
}
}
class student_node
{
int stu_number;
String stu_name;
String major;
double gpa;
student_node next;
}
Step by step
Solved in 3 steps