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