Commits

Takayuki KONDO committed c95718f

improve ShoppingMain class

  • Participants
  • Parent commits d62aacc

Comments (0)

Files changed (1)

File curry/ShoppingMain.java

+import java.util.ArrayList;
+
 public class ShoppingMain{
     public static void main(String[] args) {
-	Beef beef = new Beef();
-	Carrot carrot = new Carrot();
-	Onion onion = new Onion();
-	Spice spice = new Spice();
+
+	ArrayList<Item> cart = new ArrayList<Item>();
+	cart.add(new Carrot());
+	cart.add(new Onion());
+	cart.add(new Onion());
+	cart.add(new Beef());
+	cart.add(new Beef());
+	cart.add(new Spice());
+
+	int totalcost = CalcItems.sumItemsPrice(cart);
+
+	System.out.println(totalcost);
     }
 }