Skip to content

Add ReturnOnInvestment to maths#235

Open
InukaWijerathna wants to merge 1 commit into
TheAlgorithms:masterfrom
InukaWijerathna:add/return-on-investment
Open

Add ReturnOnInvestment to maths#235
InukaWijerathna wants to merge 1 commit into
TheAlgorithms:masterfrom
InukaWijerathna:add/return-on-investment

Conversation

@InukaWijerathna
Copy link
Copy Markdown

Description

Adds ReturnOnInvestment to the maths/ directory.

Return on Investment (ROI) is a foundational financial metric that quantifies investment profitability as a percentage:

ROI = (Gain - Cost) / Cost × 100

What's included

  • maths/return_on_investment.rb — Ruby class with frozen string literal, raises ArgumentError for non-positive cost

Checklist

  • Follows the code style of the project (class with self.call, frozen_string_literal, guard clause)
  • Raises ArgumentError for non-positive cost
  • Uses .to_f to ensure float division

Reference: https://www.investopedia.com/terms/r/returnoninvestment.asp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant