Exemple #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);
 }
Exemple #2
0
 public ArrayList addApple(Apple apple)
 {
     items.Add(apple);
     return(items);
 }
Exemple #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]);
 }