class FifoLifo::Main
Public Class Methods
new(bitcoins, prices)
click to toggle source
# File lib/fifo_lifo.rb, line 12 def initialize(bitcoins, prices) @utils = Utilities.new(bitcoins, prices) @fifo = Fifo.new(@utils) @lifo = Lifo.new(@utils) end
Public Instance Methods
display_results()
click to toggle source
displays all of the result desired
# File lib/fifo_lifo.rb, line 19 def display_results fifo_gotten_results = @fifo.get_profit_or_lost_with_fifo fifo_cost_of_goods_sold = fifo_gotten_results[1] fifo_total_income = fifo_gotten_results[2] lifo_gotten_results = @lifo.get_profit_or_lost_with_lifo lifo_cost_of_goods_sold = lifo_gotten_results[1] lifo_total_income = lifo_gotten_results[2] units_purchased = @utils.get_unit_purchased units_sold = @utils.get_unit_sold final_invetory = units_purchased + units_sold puts "\n\n" puts "======= The following are the general results regardless of FIFO nor LIFO approach =======" puts "============================================================================================" puts "The final invetory is: #{final_invetory}" puts "Units sold are: #{units_sold}" puts "Units purchased are: #{units_purchased}" puts "The total cost is: #{@utils.get_total_cost}" puts "\n\n" puts "======= The following are the results gotten if we perform the FIFO approach =======" puts "======================================================================================" puts "The cost_of_goods_sold with FIFO is: #{fifo_cost_of_goods_sold}" puts "The total_income with FIFO is: #{fifo_total_income}" puts fifo_gotten_results[0] puts "\n\n" puts "======= The following are the results gotten if we perform the LIFO approach =======" puts "======================================================================================" puts "The cost_of_goods_sold with LIFO is: #{lifo_cost_of_goods_sold}" puts "The total_income with LIFO is: #{lifo_total_income}" puts lifo_gotten_results[0] puts "\n\n" end