Question
Here is a sample of the instructions (caller) in Test.java: String s = 2 , 3/4, 1/16, 2 3/2, 2 2/4,,,1 5/2,;//code to read
Here is a sample of the instructions (caller) in Test.java: String s = " 2 , 3/4, 1/16, 2 3/2, 2 2/4,,,1 5/2,";//code to read from keyboard via Scanner
s = Utility.clean(s);
System.out.println("CleanOrig=|" + s+"|" ); //Outputs: "2,3/4,1/16,2 3/2,2 2/4,1 5/2"
SortSP obj = new SortSP(s);
System.out.println("init array of Fractions = " + obj ); //Outputs: "2,3/4,1/16,7/2,5/2,7/2"
obj.bubbleSP(); // sort array using bubble, insertion, or selection
System.out.println("Fractions in increasing order = " + obj ); //Outputs: "1/16,3/4,2,5/2,7/2,7/2"
Outline of class SortSP: a. Name of class is "Sort" followed by your initials in upper cases. b. There are 2 attributes: (Note: You should not add any extra attributes)
String sSP; //name of string started with "s" followed by your initials in upper cases.
Fraction[] aSP;// name of array started with "a" followed by your initials in upper cases. c. methods:
-
resetSP: to set the second attribute to be its original, (not create any unnecassary new fractions) .
-
bubbleSP: to sort the 2nd attribute in increasing order.
-
additional methods to make the sample work Note: SP are the initials of your instructor. You need to replace they by yours.
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