diff --git a/app/controllers/calculations_controller.rb b/app/controllers/calculations_controller.rb index 0df2d0f..69119c2 100644 --- a/app/controllers/calculations_controller.rb +++ b/app/controllers/calculations_controller.rb @@ -11,13 +11,13 @@ def word_count # ================================================================================ - @word_count = "Replace this string with your answer." + @word_count = @text.split.count - @character_count_with_spaces = "Replace this string with your answer." + @character_count_with_spaces = @text.length - @character_count_without_spaces = "Replace this string with your answer." + @character_count_without_spaces = @text.gsub(' ', '').length - @occurrences = "Replace this string with your answer." + @occurrences = @text.downcase.scan(@special_word.downcase).length # ================================================================================ # Your code goes above. @@ -38,7 +38,7 @@ def loan_payment # The principal value the user input is in the decimal @principal. # ================================================================================ - @monthly_payment = "Replace this string with your answer." + @monthly_payment = ((@apr/100/12 * @principal) / (1 - (1 + @apr/100/12)**(-@years*12))) # ================================================================================ # Your code goes above.