Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need to develop a JAVA appli/cation that prom/pts a user to create fi/ve stude

ID: 3699151 • Letter: I

Question

I need to develop a JAVA appli/cation that prom/pts a user to create fi/ve students by en/tering a first name, last n/ame, and a single test score bet/ween 0 and 100. After the stu/dents have been entered, sort the students by test sc/ore using the selection so/rt method in descending order (highest to lowest) and print the /list of students to the Co/nsole. I have the Sorting CLASS prepared to sort the students, demonstrating polymorphism with interfaces, and develop at least two other classes (in addition to the driver class) for this assignment.

////////CLASS SORTING////////

public class Sorting
{

   public static void selectionSort (Comparable<Object>[] list)
   {
      int min;
      Comparable<Object> temp;

      for (int index = 0; index < list.length-1; index++)
      {
         min = index;
         for (int scan = index+1; scan < list.length; scan++)
            if (list[scan].compareTo(list[min]) < 0)
               min = scan;

     
         temp = list[min];
         list[min] = list[index];
         list[index] = temp;
      }
   }


   public static void insertionSort (Comparable<Object>[] list)
   {
      for (int index = 1; index < list.length; index++)
      {
         Comparable<Object> key = list[index];
         int position = index;

   
         while (position > 0 && key.compareTo(list[position-1]) < 0)
         {
            list[position] = list[position-1];
            position--;
         }
          
         list[position] = key;
      }
   }
}

Explanation / Answer

To get user details like first name , last name and score.

public class StudentDetails {

public static void main(String[] args)

{
Scanner input = new Scanner(System.in);
System.out.print("Enter the number of students:- ");

int num = input.nextInt();

int[] grades = new int[num];
String[] fname = new String[num];
String[] lname = new String[num];

int grade = 0;
String firstname = "";
String lastname = "";

for(int i = 0; i < num; i++)

{
firstname = input.next();
lastname = input.next();
grade = input.nextInt();
fname[i] = firstname;
lname[i] = lastname;
grades[i] = grade;
System.out.println("");
}


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote