Skip to content
This repository was archived by the owner on Sep 27, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Alexander_Angelosky_1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require "csv"
def calculate_balance
start_day = ARGV[0]
end_day = ARGV[1]
income = 0.00
expence = 0.00
CSV.foreach("bank.csv") do |row|
if row[0] >= start_day and row[0] <= end_day then
income = income + row[1].to_f
expence = expence + row[2].to_f
end
end
puts income.to_s+","+expence.to_s+","+(income-expence).to_s
end
calculate_balance