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

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!