Beispiel #1
0
 public double totalCost(Apple apple, Orange orange)
 {
     for (int i = 0; i < items.Count; i++)
     {
         if (items[i] == apple)
         {
             amount += apple.price;
         }
         if (items[i] == orange)
         {
             amount += orange.price;
         }
     }
     return(amount);
 }
Beispiel #2
0
 public ArrayList addOrange(Orange orange)
 {
     items.Add(orange);
     return(items);
 }
Beispiel #3
0
 static void Main(string[] args)
 {
     Apple    apple    = new Apple(0.6);
     Orange   orange   = new Orange(0.25);
     Checkout checkout = new Checkout(0, [apple, apple, orange]);
 }