title: Finding item with the lowest cost in an ArrayList
body: <p>What I need to do is find the inventory item with the lowest cost from an array list. If there are none, return "N/A". So I can't really figure out how to find the smallest value out of all the inventory item costs. This is what I have so far. My plan was to set cost equal to the first inventory item and cycle through each item checking if it's cost is less but I'm confused on how to do that or if that is even the correct way of doing it.</p>
  
  <p>EDIT: We have not covered for loops yet so I cannot use them. I can only use while loops</p>
  
  <pre><code>public InventoryItem itemWithLowestCost() {
      if (inventoryList.size() &gt; 0) {
          int i = 0;
          while (i &lt; inventoryList.size()) {
              double cost = inventoryList.get(i).getCost();
              if (cost &lt; )
          }
  
      }
      else {
          return "N/A";
      }
  }
  </code></pre>
  
  <p>Here is my InventoryItem constructor. I'm not sure if this is needed to understand the above code but here it is anyway</p>
  
  <pre><code>public InventoryItem(String descriptionIn, double costIn, double percentDepreciatedIn) {
      description = descriptionIn.trim();
      cost = costIn;
      percentDepreciated = percentDepreciatedIn;
  }
  </code></pre>