Question: Create a class that can be used to test data structure - similar to the StudentA.java example found shown below: The following are requirements for

Create a class that can be used to test data structure - similar to the StudentA.java example found shown below:

The following are requirements for this homework: Unique index integer fields Use at least 5 other fields of various, including at least one of each of String, int and double types. o assume that the String's have no spaces within them Write a method that will create an array of N random instances of this class, where N is an integer parameter to this method Provide a toString method that will format an instance of this class nicely Provide appropriate constructors Write methods that will write and read text files of this class o to make this easy, assume that the first line of the file is the number of elements in the file o make the file one line per entry o use spaces as field delimiters in the files o use the toString method of the class to write to the file Provide a good GUI interface to control and test this class, at a minimum: o use buttons to control the functions available o use JFileChoose for selecting input and output files o use a JTextArea and JScrollPane to create a scrolling text area for output o the window should resize nicely - use BorderLayout with the text area in the center

Create a class that can be used to test data structure -

similar to the StudentA.java example found shown below: The following are requirements

StudentA.java import java.util.Scanner; import java.util.ArrayList; lass StudentA lements Comparable firstName s = new ArrayList (); static ArrayList lastName s new ArrayList (); static SORTBY sortBy- SORTBY. LAST; static int nextU1D = 1; String first, last; double gpa - 0 int credits = 0; int uid try java.util.Scanner scFirst-new java.util.Scanner (new java.util. Scanner scLast = new java.util. Scanner (new while (scFirst.hasNext ()) firstNames.add (scFirst.next )) java.io.File("firstNames.txt")); java.io.File ("lastNames.txt")); while scLast.hasNext ()) lastNames.add ( scLast.next )) catch (java.io.FileNotFoundException e) System.out.println (e); ) // end try catch // end static intializer //end static intializer enum SORTBY (LAST, FIRST, CREDITS, GPA) uden ring S this (new Scanner (st) ) uden anner s ul first last credits gpa nextUID++; sc. next () ; sc. next ( ) ; sc. next Int () ; sc. next Double ( ) ; = = // end Scanner constructor public StudentA uid-nextUID++; // no parameter constructor nt compareld uden switch (sortBy) [ case LAST: return last.compareTo (x.last)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!