I would need to provide students.dat file. I am not sure how to send that students.dat file. This program need to work on Replit. Please make the code work and check the picture attached for instructions.   // The Student Records Algorithm Program // This is the student, starting version of the  assignment. import java.io.*; import java.util.*; import java.text.DecimalFormat; public class Main { public static void main(String[] args) throws IOException {  List studentArray = new List(100);  studentArray.getList();  studentArray.display("UNSORTED LIST OF STUDENTS");  studentArray.pause();  studentArray.gpaSort();  studentArray.display("STUDENTS SORTED IN DESCENDING ORDER BY GPA");  studentArray.pause();  studentArray.ageSort();  studentArray.display("STUDENTS SORTED IN ASCENDING ORDER BY AGE");  studentArray.pause();  studentArray.idSort();  studentArray.display("STUDENTS SORTED IN ASCENDING ORDER BY ID#");  studentArray.pause(); //  int studentID = getID(); //  int index = studentArray.search(studentID); // //  if (index == -1) //      System.out.println("There is no student with an ID# of "+studentID+".\n"); //  else //  { //   studentArray.displayStudent(index);   // displays the information for the found student //   studentArray.delete(index);           // remove the same student from the array //   studentArray.display("STUDENTS SORTED IN ASCENDING ORDER BY ID# WITHOUT STUDENT# "+studentID); //   studentArray.pause(); //  } } public static int getID() {  Scanner input = new Scanner(System.in);  System.out.print("\nEnter the 6-digit ID of the student.  { 100000 - 999999 }  -->  ");  return input.nextInt(); } } class Person { public String name; public int id; public int age; public double gpa; Person(String n, int ID, int a,double g) {  name = n;  id = ID;  age = a;  gpa = g; } } class List { private Person student[]; // stores array elements private int capacity;  // actual array capacity private int size;   // number of elements in the array public List(int c) {  capacity = c;  size = 0;  student = new Person[capacity]; } public void getList() throws IOException {  FileReader inFile = new FileReader("students.dat");  BufferedReader inStream = new BufferedReader(inFile);  String s1,s2,s3,s4;  int age, id;  double gpa;  int index = 0;  while( ((s1 = inStream.readLine()) != null) &&      ((s2 = inStream.readLine()) != null) &&      ((s3 = inStream.readLine()) != null) &&      ((s4 = inStream.readLine()) != null) )  {   String name = s1;   id = Integer.parseInt(s2);   age = Integer.parseInt(s3);   gpa = Double.parseDouble(s4);   student[index] = new Person(name,id,age,gpa);   index++;  }  inStream.close();  size = index; } private String spaces(String name)    {     int tab = 24 - name.length();     String temp = "";     for (int j = 1; j <= tab; j++)         temp += " ";     return temp;    } public void display(String listInfo) {  DecimalFormat output = new DecimalFormat("0.000");  System.out.println("\nDISPLAYING "+ listInfo);  System.out.println("\nStudent ID#     Student Name            Age         GPA");  System.out.println("============================================================");  for (int k = 0; k < size; k++)   System.out.println(student[k].id + "          "+student[k].name + spaces(student[k].name) + student[k].age + "          " + output.format(student[k].gpa)); } public void pause() {  Scanner input = new Scanner(System.in);  String dummy;  System.out.println("\nPress to continue.");  dummy = input.nextLine(); } public void displayStudent(int index) {    System.out.println "Student" +     System.out.println } private void swap(int x, int y) {    boolean found = false;     } public void gpaSort() { } public void ageSort() {    for(int k = 0; k < numbers1.length; k++)      int elements  = k+1; } public void idSort() { } // public int search(int studentID) // {      boolean found = false;      int low;      int high = list.size()-1;      int mid = -1;      while(low) // } public void delete(int index) {  // Precondition:  "index" stores the index of a student object that exists in the "student" array.  // Postcondition: The student object at index "index" is removed from the "student" array.  //                All other objects in the "student" array are unaffected.

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

I would need to provide students.dat file. I am not sure how to send that students.dat file. This program need to work on Replit. Please make the code work and check the picture attached for instructions.

 

// The Student Records Algorithm Program
// This is the student, starting version of the  assignment.


import java.io.*;
import java.util.*;
import java.text.DecimalFormat;


public class Main
{
public static void main(String[] args) throws IOException
{
 List studentArray = new List(100);
 studentArray.getList();
 studentArray.display("UNSORTED LIST OF STUDENTS");
 studentArray.pause();

 studentArray.gpaSort();
 studentArray.display("STUDENTS SORTED IN DESCENDING ORDER BY GPA");
 studentArray.pause();

 studentArray.ageSort();
 studentArray.display("STUDENTS SORTED IN ASCENDING ORDER BY AGE");
 studentArray.pause();

 studentArray.idSort();
 studentArray.display("STUDENTS SORTED IN ASCENDING ORDER BY ID#");
 studentArray.pause();

//  int studentID = getID();
//  int index = studentArray.search(studentID);
//
//  if (index == -1)
//      System.out.println("There is no student with an ID# of "+studentID+".\n");
//  else
//  {
//   studentArray.displayStudent(index);   // displays the information for the found student
//   studentArray.delete(index);           // remove the same student from the array
//   studentArray.display("STUDENTS SORTED IN ASCENDING ORDER BY ID# WITHOUT STUDENT# "+studentID);
//   studentArray.pause();
//  }
}

public static int getID()
{
 Scanner input = new Scanner(System.in);
 System.out.print("\nEnter the 6-digit ID of the student.  { 100000 - 999999 }  -->  ");
 return input.nextInt();
}
}


class Person
{
public String name;
public int id;
public int age;
public double gpa;

Person(String n, int ID, int a,double g)
{
 name = n;
 id = ID;
 age = a;
 gpa = g;
}
}


class List
{
private Person student[]; // stores array elements
private int capacity;  // actual array capacity
private int size;   // number of elements in the array

public List(int c)
{
 capacity = c;
 size = 0;
 student = new Person[capacity];
}

public void getList() throws IOException
{
 FileReader inFile = new FileReader("students.dat");
 BufferedReader inStream = new BufferedReader(inFile);
 String s1,s2,s3,s4;
 int age, id;
 double gpa;
 int index = 0;
 while( ((s1 = inStream.readLine()) != null) &&
     ((s2 = inStream.readLine()) != null) &&
     ((s3 = inStream.readLine()) != null) &&
     ((s4 = inStream.readLine()) != null) )
 {
  String name = s1;
  id = Integer.parseInt(s2);
  age = Integer.parseInt(s3);
  gpa = Double.parseDouble(s4);

  student[index] = new Person(name,id,age,gpa);
  index++;
 }
 inStream.close();
 size = index;
}

private String spaces(String name)
   {
    int tab = 24 - name.length();
    String temp = "";
    for (int j = 1; j <= tab; j++)
        temp += " ";
    return temp;
   }

public void display(String listInfo)
{
 DecimalFormat output = new DecimalFormat("0.000");
 System.out.println("\nDISPLAYING "+ listInfo);
 System.out.println("\nStudent ID#     Student Name            Age         GPA");
 System.out.println("============================================================");

 for (int k = 0; k < size; k++)
  System.out.println(student[k].id + "          "+student[k].name + spaces(student[k].name) + student[k].age + "          " + output.format(student[k].gpa));
}

public void pause()
{
 Scanner input = new Scanner(System.in);
 String dummy;
 System.out.println("\nPress <Enter> to continue.");
 dummy = input.nextLine();
}

public void displayStudent(int index)
{
   System.out.println "Student" + 
   System.out.println

}

private void swap(int x, int y)
{
   boolean found = false;
   

}

public void gpaSort()
{

}

public void ageSort()
{
   for(int k = 0; k < numbers1.length; k++)
     int elements  = k+1;

}

public void idSort()
{

}

// public int search(int studentID)
// {
     boolean found = false;
     int low;
     int high = list.size()-1;
     int mid = -1;
     while(low)

// }

public void delete(int index)
{
 // Precondition:  "index" stores the index of a student object that exists in the "student" array.
 // Postcondition: The student object at index "index" is removed from the "student" array.
 //                All other objects in the "student" array are unaffected.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Header Files
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
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