Click this link to see this program running on replit: fifo_lifo on replit, you will need to click on run button
-
Run this command
git clone https://github.com/descholar-ceo/fifo-lifo.git && cd fifo-lifoto clone and go in this repo -
Run
ruby bin/main.rb
It will display the result based on the following inputs:
purchases_and_sells = [4, -2, -1, 5, -0.5, -0.5, -4.5] # Positive indicate purchase, negative indicate sells
prices = [5000, 6500, 7000, 6000, 8000, 9000, 6500] # Each price is for a purchase or sells of the same index from purchases_and_sells array