Build a Progress Tracking Class in Ruby

0
811

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.

Summary

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

Exercise File

Code File

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.

Solution

Can be found on the solutions branch on github.

LEAVE A REPLY

Please enter your comment!
Please enter your name here