"buy xshare(sat $ eachor "sell share(sat $ each,assuming that the transactions occur on consecutive days and the values and are integers given this input sequencethe output should be the total capital gain (or lossfor the entire sequenceusing the fifo protocol to identify shares notes we were introduced to the approach of defining data structures first in terms of their adts and then in terms of concrete implementations by the classic books by ahohopcroftand ullman [ ]which incidentally is where we first saw aproblem similar to exercise - exercises - - and - are similar to interview questions said to be from well-known software company for further study of abstract data typessee liskov and guttag [ ]cardelli and wegner [ ]or demurjian [ lists and iterators contents array lists the array list abstract data type the adapter pattern