title: primitive type double error
body: <p>sorry if my question looks very stupid. I get error on .compareTo() Cannot invoke compareTo(double) on the primitive type double! how can i fix this ? Thank you!</p>
  
  <p>Vehicle class: </p>
  
  <pre><code>public class Vehicle implements IOutput {
  private double cost;}
  
  public double getCost(){
          return cost;
      }
  </code></pre>
  
  <p>Array Class:</p>
  
  <pre><code>public static void sortByVehicleMakeModel(Vehicle[] vehicles) {
  
      boolean swapped = true;
  
      for(int y = 0; y &lt; vehicles.length &amp;&amp; swapped; y++) {
          swapped=false;
          for(int x = 0; x &lt; vehicles.length - (y+1); x++) {
              if(vehicles[x].getCost().compareTo(vehicles[x + 1].getCost()) &gt; 0){
                  swap(vehicles, x, x + 1);
                  swapped=true;
              }
          }
      }
  }
  </code></pre>
  
  <p>my other codes works fine:</p>
  
  <pre><code>public static void sortByOwnerName(Vehicle[] vehicles) {
      boolean swapped = true;
  
      for(int y = 0; y &lt; vehicles.length &amp;&amp; swapped; y++) {
          swapped=false;
          for(int x = 0; x &lt; vehicles.length - (y + 1); x++) {
              if(vehicles[x].getOwner().getName().compareTo(vehicles[x + 1].getOwner().getName())&gt; 0) {   
                  swap(vehicles, x, x + 1);
                  swapped=true;
              }
          }
      }
  }
  </code></pre>