A database is to be developed to keep track of student information at your colle
ID: 3805751 • Letter: A
Question
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 no-parameter constructor. Test it with a progressively developed driver program that verifies the functionality of all of its methods.
figure 2.28
public class Node
{
private String name; //key field
private String address;
private String number;
public Node(String n, String a, String num)
{
name=n;
address =a;
number= num;
}
public String toString()
{
return("Name is" + name +
" Address is" + address +
" Number is" + number + " ");
}
public Node deepCopy()
{
Node clone = new Node(name, address,number);
return clone;
}
public int compareTo(String targetKey)
{
return(name.compareTo(targetKey));
}
public void setAddress(String a) // coded to demonstrate
//encapsulation
{
address = a;
}
public void input()
{
name = JOprtionPane.shoInputDialog("Enter a name");
address = JOptionPane.showInputDialog("Enter an address");
number = JOptionPane.showInputDialog("Enter a number");
} // end of inputNode method
//end of class Node
include pseudo code and flow chart please
Explanation / Answer
package com.assign2.jagrelot;
import java.util.Scanner;
public class StudentListings {
private String name; // key
private String number;
private String gpa;
public StudentListings() {
this.name = " ";
this.number = " ";
this.gpa = " ";
}
public StudentListings(String name, String number, String gpa) {
this.name = name;
this.number = number;
this.gpa = gpa;
}
public String toString() {
return ("Name : " + name + " ID# : " + number + " GPA : " + gpa);
}
public StudentListings deepCopy() {
StudentListings clone = new StudentListings(name, number, gpa);
return clone;
}
public int compareTo(String targetKey) {
return name.compareTo(targetKey);
}
public void input() {
Scanner userInput = new Scanner(System.in);
System.out.print("Enter a name : ");
name = userInput.nextLine();
System.out.print("Enter an ID# : ");
number = userInput.nextLine();
System.out.print("Enter GPA : ");
gpa = userInput.nextLine();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getGpa() {
return gpa;
}
public void setGpa(String gpa) {
this.gpa = gpa;
}
}