Answered step by step
Verified Expert Solution
Question
1 Approved Answer
public class ICA05 { /** * @param args the command line arguments */ public static void main(String[] args) { String[] names = {James, Harry, Sally,
public class ICA05 { /** * @param args the command line arguments */ public static void main(String[] args) { String[] names = {"James", "Harry", "Sally", "Emily", "Colin", "Mike", "Lisa"}; Integer[] scores = {95, 77, 91, 78, 81, 85, 86}; out.println("CPS 151 ICA 5 by Your name here"); out.println(" The array of names before sorting: "); out.println(Arrays.toString(names)); // SelectionSorter.sort(names); // commented to avoid compile error out.println("The array of names after sorting: "); out.println(Arrays.toString(names)); out.println(" The array of scores before sorting: "); out.println(Arrays.toString(scores)); // SelectionSorter.sort(scores); // commented to avoid compile error out.println("The array of scores after sorting: "); out.println(Arrays.toString(scores)); out.println(" ICA 5 -- Goodbye!"); } // end main } // end class /** * The sort method of this class sorts an array, using the selection sort * algorithm. */ // TODO: Make the methods generic class SelectionSorter { /** * Sorts an array, using selection sort. * * @param a the array to sort */ public static void sort(int[] a) { for (int i = 0; i Create a standard Java application using NetBeans. Name it ICA05 .Let NetBeans create the main class for you. .Delete the code created by NetBeans and copy-paste code from ICAO5_Start.txt. This includes the main class and a skeleton class which will contain the generic method for selection sorting and any other methods needed. Convert the methods in the selection soterclass to use generic types as appropriate. Uncomment the two calls to SelectionSorter.sort in the main method . Generic typing considerations: Specify as little about the type as is necessary to support your code: Sample Output Output ICA05_Key (run) run: CPS 151 ICA 5 by KEY The array of names before sorting: [James, Harry, Sally, Emily, Colin, Mike, Lisa] The array of names after sorting: [Colin, Emily, Harry, James, Lisa, Mike, Sally] The array of scores before sorting: [95, 77, 91, 78, 81, 85, 86] The array of scores after sorting: [77, 78, 81, 85, 86, 91, 95] ICA 5 Goodbye! BUILD SUCCESSFUL (total time: 1 second)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started