This guide walks through how to implement a progress tracking class in Ruby that can update a user’s progress and dynamically update the overall percent completed.
Implement a class that tracks a user’s completion percentage and dynamically allows a user to update it.
Build a class that tracks the completed percentage of a course for a student, and when the student marks a task complete, the class should update the percent complete to reflect the updated value.
c = Completion.new(number_of_guides: 100, total_completed: 55) c.completed_percentage # => 0.55 c.mark_complete c.completed_percentage # => 0.56
Real World Usage
Tracking progress and dynamically updating values is a common process in Ruby development. This exercise will test your ability to build a class, work with data in the class, and generate different outcomes based on method calls.
Can be found on the solutions branch on github.