Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//= require bootstrap
//= require turbolinks
//= require_tree .
//= require jquery
//= require moment
//= require bootstrap-datetimepicker

Expand Down
23 changes: 12 additions & 11 deletions app/controllers/calculations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.size

@character_count_without_spaces = "Replace this string with your answer."
@character_count_without_spaces = @text.gsub(" ","").size

@occurrences = "Replace this string with your answer."
@occurrences = @text.downcase.gsub(/[^a-z0-9\s]/i,"").split.count(@special_word.downcase)

# ================================================================================
# Your code goes above.
Expand All @@ -38,7 +38,8 @@ def loan_payment
# The principal value the user input is in the decimal @principal.
# ================================================================================

@monthly_payment = "Replace this string with your answer."
@apr_decimal = @apr/1200
@monthly_payment = (@apr_decimal/(1-(1+@apr_decimal)**(-1*@years*12)))*@principal

# ================================================================================
# Your code goes above.
Expand All @@ -60,12 +61,12 @@ def time_between
# number of seconds as a result.
# ================================================================================

@seconds = "Replace this string with your answer."
@minutes = "Replace this string with your answer."
@hours = "Replace this string with your answer."
@days = "Replace this string with your answer."
@weeks = "Replace this string with your answer."
@years = "Replace this string with your answer."
@seconds = @ending-@starting
@minutes = @seconds/60
@hours = @minutes/60
@days = @hours/24
@weeks = @days/7
@years = @weeks/52 #hopefully this is done

# ================================================================================
# Your code goes above.
Expand Down