Esempio n. 1
0
 public containerProcessor()
 {
     container1 = new container();
     container2 = new container();
     containerSteps = new List<containerStep>();
     containerSummary = new containerSummary();
 }
Esempio n. 2
0
        public int transfer(container containerTransferInto)
        {
            if (containerTransferInto.gallons + this.gallons > containerTransferInto.capacity)
            {
                //if this container holds more gallons than the other, then only transfer the correct amount, and hte remainder stays in the current container
                this.gallons = this.gallons - (containerTransferInto.capacity - containerTransferInto.gallons);
                containerTransferInto.gallons = containerTransferInto.capacity;
            }
            else
            {
                //otherwise pour all the contents into the new container, and the current container becomes empty
                containerTransferInto.gallons = containerTransferInto.gallons + this.gallons;
                this.gallons = 0;
            }

            return this.gallons;
        }