Cannot find Symbol MenuItem
<p>I'm writing a code where I have an ArrayList input and from that ArrayList I have to get two numbers from that and subtract them. When I'm doing this I get a Cannot find Symbol error. Why am I getting this error?</p>

<pre><code>public static double[] profits( ArrayList&lt;MenuItem&gt; items )
{
 double[] lol = new double[items.size()];
 for ( MenuItem z : items )
  {
     for ( int i = 0; i &lt; lol.length  ; i++ )
      {
        lol[i] = roundMoney(getPrice() - getCost());
      }
    return lol;
  }
}
</code></pre>

<p>this is the main class:</p>

<pre><code>     ArrayList&lt;MenuItem&gt; items = new ArrayList&lt;MenuItem&gt;();
    items.add( new MenuItem( "Alliteration Armadillo", 20.25, 3.15, 1, true ) );
    items.add( new MenuItem( "Consonance Chameleon", 5.45, 0.75, 0, false ) );
    items.add( new MenuItem( "Assonance Bass", 1.95, 0.50, 1, false ) );

    double[] t = profits( items );

    for ( double d : t )
      System.out.print( printAmount( d ) + " " );
</code></pre>

<p>What my output is supposed to be is a array of doubles that should output {17.10 4.70 1.45}</p>

<pre><code>The error says:

TC1.java:17: cannot find symbol 

symbol  : method getPrice()

If this isn't enough information then here is the whole class:

public class MenuItem 
{ 
  private String myName; 

  private double myPrice, 
                 myCost; 

  private int    myCode; 

  private boolean myAvailability; 

  public MenuItem( String name, double price, double cost, int code, boolean available ) 
  { 
    myName = name; 
    myPrice = price; 
    myCost = cost; 
    myCode = code; 
    myAvailability = available; 
  } 

  public String getName() { return myName; } 
  public double getPrice() { return myPrice; } 
  public double getCost() { return myCost; } 
  public int getCode() { return myCode; } 
  public boolean available() { return myAvailability; } 

  // Create your method here 
  public String menuString() 
  { 
  return getName() + " ($" + getPrice() + ")"; 
  } 

  public static double roundMoney( double amount ) 
  { 
    return (int)(100 * amount + 0.5) / 100.0; 
  } 

  public static String printAmount( double d ) 
  { 
    String s = "" + d; 
    int k = s.indexOf( "." ); 
    if ( k &lt; 0 ) 
      return s + ".00"; 
    if ( k + 1 == s.length() ) 
      return s + "00"; 
    if ( k + 2 == s.length() ) 
      return s + "0"; 
    else 
      return s; 
  } 
} 
</code></pre>

<p>F</p>
