Hi. I have 3 stacks (bucket1, bucket2, barrel). I want to implement 3 methods that do the following:
fill() - fills bucket1 or bucket2 with elements taken from barrel;
empty() - transfers all elements from bucket1 or bucket2 into barrel;
transfer()- transfers elements from bucket1 to bucket2 and vice-versa until one of them is either full or empty;
Barrel starts full with elements at first, then you take elements from barrel using bucket1/2.fill() and so on until you reach your goal. My goal here is to measure 4 liters. I already have the algorithm for that. I just need to know how to implement these 3 methods for my Stack class. PLEASE NOTE I am not using <stack>, but my own template class called Stack with various methods. Here it is below.