Write a test program that creates an array of 10 GeometricObjects and invokes this method using the GeometricObjectComparator introduced in Listing 20.4 to sort the elements.

Posted: March 9th, 2022

Question NO 1
1. Write the following method that sorts an ArrayList:
public static void sort(ArrayList list)
2. Create statements in your main method to test the method
(a) Create and populate an object of type ArrayList
(b) Execute your introduction method – informs the operator what the program will do
(c) Print the contents of the ArrayList before the sort
(d) Call the sort method
(e) Print the contents of the ArrayList after the sort
please use jGRASP JavaFX to code. Provide code and result
Question NO 2
1. Write the following generic method using selection sort and a comparator:
public static void selectionSort(E[] list, Comparator comparator)
2. Write a test program that creates an array of 10 GeometricObjects and invokes this method using the GeometricObjectComparator introduced in Listing 20.4 to sort the elements.
3. Include an introduction() method that explains to the user what the program will do.
4. Display the unsorted elements, then display the sorted elements.
5. Use the following statement to create the array.
GeometricObject[] list = {new Circle(5), new Rectangle(4, 5),
new Circle(5.5), new Rectangle(2.4, 5),
new Circle(0.5), new Rectangle(4, 65),
new Circle(4.5), new Rectangle(4.4, 1),
new Circle(6.5), new Rectangle(4, 5) };
** Don’t forget to import java.util.Comparator;
Also in the same program, write the code that sorts six Strings by their last character.
Use the following statement to create the array:
String[ ] list2 = {“red”, “blue”, “green”, “yellow”, “orange”, “pink”};
please use jGRASP JavaFX to code. Provide code and result
PLEASE I NEED THE CODE TO COPY AND ALSO SCREEN SHOT THAT SHOWS THE CODE WORKS

Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00