import java.util.Vector;
import java.io.*;

class Hamburger extends FoodItem {

	public static final String name = "Hamburger";
 	private static final double myPrice = 2.5;
 

 	public Vector toppings = new Vector();

    /* price: Return the price of the Hamburger, including the price
     *    of any toppings.
     */
 	public double price() {
 		double total = myPrice;
 		
 		for(int i = 0; i < toppings.size(); i++) {
 			Topping t = (Topping)toppings.get(i);
 			total += t.getPrice();
 		} 
  		return total;
  	
  		
  	}
 
 	/* Hamburger: Processes the input stream, adding the appropriate
  	*              toppings to the toppings vector.
  	*
  	* pre:   in is an initialized BufferedReader, that this 
  	*              Hamburger will use to read in the list of toppings
  	*/
 	public Hamburger(BufferedReader in) throws IOException {

  		String next = in.readLine();
		while (next != null && !next.equals("")) {
   
   			toppings.add(new Topping(next));
   			next = in.readLine();
  		}
 	}
 	
 	public Hamburger() {
 	
 	}
 	
 	public void addTopping(String t) {
 		toppings.add(new Topping(t));
 	}

 	/* toString: Returns a string representation of this
  	*    Hamburger
  	*/ 
 	public String toString() {
  		String toReturn="Hamburger" + " " + myPrice;
  
  		for(int i = 0; i < toppings.size(); i++) {  
   			toReturn += " " + toppings.get(i);
  		}
  		toReturn += "\n";
  		return toReturn;
 	}
 	/* Two hamburgers are equal if they have the same list of toppings
  	 */
 	public boolean equals(Hamburger h) {
 
		for(int i = 0; i < toppings.size(); i++) {
			boolean found = false;
			for(int k = 0; k < toppings.size(); k++) {
				if(((Topping)toppings.get(i)).equals(
                                    (Topping)h.toppings.get(k))) {
					found = true;
					break;
				}
			}
			if( !found ) return false;
		}
 
                for(int i = 0; i < toppings.size(); i++) {
			boolean found = false;
			for(int k = 0; k < toppings.size(); k++) { 
				if(((Topping)h.toppings.get(i)).equals(
               		            (Topping)toppings.get(k))) {
					found = true;
					break;
				}
			}
			if( !found ) return false;
		}
		return true;
	}

}
