Modify the selection sort algorithm to sort an array of coins by their value.

Complete the following file:

SelectionSorter.java

Use the following files:

Coin.java

/**
   A coin with a monetary value.
*/
public class Coin
{
   private double value;
   private String name;

   /**
      Constructs a coin.
      @param aValue the monetary value of the coin.
      @param aName the name of the coin
   */
   public Coin(double aValue, String aName) 
   { 
      value = aValue; 
      name = aName;
   }

   /**
      Gets the coin value.
      @return the value
   */
   public double getValue() 
   {
      return value;
   }

   /**
      Gets the coin name.
      @return the name
   */
   public String getName() 
   {
      return name;
   }
   
   /**
      Returns a string representation of the object.
      @return name and value of coin
   */
   public String toString()
   {
      return "Coin[value=" + value + ",name=" + name + "]";
   }
}

SelectionSorterTester.java

import java.util.Arrays;

public class SelectionSorterTester
{ 
   public static void main(String[] args)
   {
      Coin[] a =
         {
            new Coin(0.05, "Nickel"),
            new Coin(0.05, "Nickel"),
            new Coin(0.25, "Quarter"),
            new Coin(0.01, "Penny"),
            new Coin(0.1, "Dime")
         };

      SelectionSorter s = new SelectionSorter(a);
      s.sort();
      System.out.println(Arrays.toString(a));
      System.out.println("Expected: [Coin[value=0.01,name=Penny], Coin[value=0.05,name=Nickel], Coin[value=0.05,name=Nickel], Coin[value=0.1,name=Dime], Coin[value=0.25,name=Quarter]]");
   }
}