Question: Write a Java program that takes as input a sequence of transactions of the form buy x share(s) at $y each or sell x share(s)
Write a Java program that takes as input a sequence of transactions of the form buy x share(s) at $y each or sell x share(s) at $y each, assuming that the transactions occur on consecutive days and the values of x and y are integers. Given this input sequence, the output should be the total capital gain (or loss) for the entire sequence, using the FIFO protocol to identify shares.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
