title: Selecting a string data type from a list
body: <p>I want so that when I enter the item code <em>"kv2"</em> it will then list the details of the item. It will only work if I enter "1)".</p>
  
  <p>I left it to do a selection based on the number because I couldn't figure out how to select the code by its name from the list.</p>
  
  <p>This is the code:</p>
  
  <pre><code>System.out.println("\nPlease enter the item code from the list you wish to order");
  int selection = Integer.parseInt(br.readLine());
  System.out.println("\nYou have ordered: " + "\nItem Code: "
      + ((ItemListing) v.get(selection - 1)).getItemCode() + " " + "\nItem Description: "
      + ((ItemListing) v.get(selection - 1)).getItemDesc());
  </code></pre>
  
  <p>Output:</p>
  
  <blockquote>
    <p>1)<br>
    Item code: #kv2  </p>
    
    <p>Item Description: peas  </p>
    
    <p>Item Weight in grams: 2.20  </p>
    
    <p>Unit Price: $2.00</p>
    
    <p>Please enter the item code from the list you wish to order  </p>
    
    <p>kv2</p>
  </blockquote>
  
  <pre><code>Exception in thread "main" java.lang.NumberFormatException: For input string: "kv2"
      at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
      at java.lang.Integer.parseInt(Integer.java:492)
      at java.lang.Integer.parseInt(Integer.java:527)
      at trekker.company.assignment.TrekkerCompanyAssignment.main(TrekkerCompanyAssignment.java:159)
  Java Result: 1
  </code></pre>