March 7 - Build a Progress Tracking Class in Ruby
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.
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
  • Complete the Exercise
Video locked
This video is viewable to users with a Bottega Bootcamp license

Summary

Implement a class that tracks a user's completion percentage and dynamically allows a user to update it.

Exercise Description

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.

Example Workflow

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.

Test Cases

Code File