Created
September 28, 2015 16:43
-
-
Save mmmries/e10b582287f167ab692f to your computer and use it in GitHub Desktop.
Example Programming Problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Goal | |
attr_accessor :name, :total_amount, :amount_saved_so_far, :predicted_to_complete_at | |
def initialize(name, total_amount, amount_saved_so_far) | |
self.name = name | |
self.total_amount = total_amount | |
self.amount_saved_so_far = amount_saved_so_far | |
end | |
end | |
def predict_goal_completion(monthly_amount_towards_goals, goals) | |
# Your Job | |
# assign the predicted_to_complete_at attribute for each goal | |
end | |
goals = [ | |
Goal.new("Eurupe Trip", 10_000.00, 0.0), | |
Goal.new("Payoff Car", 18_384.13, 4_631.22), | |
Goal.new("Sweet Shoes", 450.00, 0.0) | |
] | |
predict_goal_completion(378.10, goals) | |
goals.each do |goal| | |
puts "#{goal.name} will be completed on #{goal.predicted_to_complete_at}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment