Getting a value from an ArrayList java
<p>I am trying to get a value from with in an <code>ArrayList</code>. I have two classes, the main and a Car class. here is the code:</p>

<pre><code>  public class CarOrders {
     public static void main (String [] args){
        Car toyota= new Car("Toyota", "$10000", "300"+ "2003");
        Car nissan= new Car("Nissan", "$22000", "300"+ "2011");
        Car ford= new Car("Ford", "$15000", "350"+ "2010");

        ArrayList&lt;Car&gt; cars = new ArrayList&lt;Car&gt;();
        cars.add(toyota);        
        cars.add(nissan);
        cars.add(ford);
     }

public static void processCar(ArrayList&lt;Car&gt; cars){
       int totalAmount=0;
       for (int i=0; i&lt;cars.size(); i++){
          cars.get(i).computeCars ();
         totalAmount+= ?? 
      // in need to add the computed values of totalprice from the Car class?

       }
      System.out.println (totalAmount);

    }


}    
class Car {
     public Car (String name, int price, int, tax, int year)
     {
       constructor.......
     }

     public void computeCars ()
     {
      int  totalprice= price+tax;
      System.out.println (name + "\t" +totalprice+"\t"+year );
     }

}
</code></pre>

<p>How would i be able to calculate <code>totalAmount</code> in the <code>processCar()</code> method where <code>totalAmount=totalAmount+totalPrice</code> from the <code>computCar()</code> method in the Car Class?</p>
