Exemplo n.º 1
0
 public void AddDeliverable(Deliverable d)
 {
     if (FindDeliverable(d.ID) == null)
     {
         myDeliverables.Add(d);
     }
     else
     {
         throw new Exception("Be aware: nothing is added!!!");
     }
 }
Exemplo n.º 2
0
        public Deliverable FindHeaviestDeliverable()
        {
            if (this.myDeliverables.Count == 0)
            {
                throw new Exception("There is no heaviest deliverable in an empty transport!");
            }

            Deliverable heaviest = this.myDeliverables[0];

            foreach (Deliverable d in this.myDeliverables)
            {
                if (d.Weight >= heaviest.Weight)
                {
                    heaviest = d;
                }
            }

            return(heaviest);
        }