a java program preferably with flowchart, but i can do that. Number 19 in the pi
ID: 3604180 • Letter: A
Question
a java program preferably with flowchart, but i can do that. Number 19 in the picture.
hat aoes hot invoke lil durute ailu Ingert methods and does check for errors. Programming Exercises 19.A database is to be developed to keep track of student information at your college. It will include names, identification numbers, and grade point averages. The data set will be accessed in the key field mode, with the student's name being the key field. Code a class named StudentListings that defines the nodes. Your class should include all the methods in the class shown in Figure 2.28 except for the setAddress( method. It should also include a ho-parameter constructor. Test it with a progressively developed driver program that verifies the functionality of all of its methods. 20. Code a classthat implements the Sorted Array structure, and write a progressively developed driver program that verifies the functionality of all of its methods. Assume that it is to store a data set whose nodes are described in Exercise 19. Include erro r checking in the code of theExplanation / Answer
import javax.swing.JOptionPane;
class Node
{
private String name;
private String id_number;
private String avg_grade;
public Node(){}
public Node(String name,String id,String grade)
{
this.name = name;
this.id_number = id;
this.avg_grade = grade;
}
public String toString()
{
return ("Name is "+this.name+
" identification number is "+this.id_number+
" grade point average is "+this.avg_grade+" ");
}
public Node deepCopy()
{
Node clone = new Node(name, id_number, avg_grade);
return clone;
}
public int compareTo(String targetKey)
{
return (name.compareTo(targetKey));
}
public void input()
{
name = JOptionPane.showInputDialog("Enter a name");
id_number = JOptionPane.showInputDialog("Enter an identification number");
avg_grade = JOptionPane.showInputDialog("Enter average grade point");
}
}
public class StudentRecord {
public static void main(String [] args)
{
// student object
Node student1 = new Node();
student1.input();
//get student1 detail
String detail1 = student1.toString();
System.out.println("Student1 details: "+detail1);
// student2
Node student2 = new Node("Rohan", "CSE", "8.95");
//compare method
System.out.println("Compare result: "+student2.compareTo("Ram")+" ");
//student2 detail
String detail2 = student2.toString();
System.out.println("Student2 details: "+detail2);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.