diff --git a/class2_homework/Alexander_Iliev_3.rb b/class2_homework/Alexander_Iliev_3.rb index 03eb136..d11db69 100644 --- a/class2_homework/Alexander_Iliev_3.rb +++ b/class2_homework/Alexander_Iliev_3.rb @@ -2,9 +2,13 @@ income = 0.00 best_date = String CSV.foreach("bank.csv")do|row| - if income < row[1].to_f - best_date = row[0] - income = row[1].to_f + if best_date == row[0] + income += row[1].to_f + else + if income < row[1].to_f + best_date = row[0] + income = row[1].to_f + end end end printf "%s", best_date