https://github.com/nsardo/ruby-change-maker
Model Ruby Gem / Project. Gives change using the least amount of tender. Includes cucumber tests.
https://github.com/nsardo/ruby-change-maker
change example-project ruby ruby-cli ruby-gem starter-project
Last synced: 8 months ago
JSON representation
Model Ruby Gem / Project. Gives change using the least amount of tender. Includes cucumber tests.
- Host: GitHub
- URL: https://github.com/nsardo/ruby-change-maker
- Owner: nsardo
- License: mit
- Created: 2017-04-21T21:56:02.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-02-24T18:29:24.000Z (over 8 years ago)
- Last Synced: 2025-03-02T08:18:46.511Z (over 1 year ago)
- Topics: change, example-project, ruby, ruby-cli, ruby-gem, starter-project
- Language: Ruby
- Homepage: https://nsardo.github.io/ruby-change-maker/
- Size: 28.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://badge.fury.io/rb/RubyChangeMaker)
# Ruby Change Maker
Given a currency amount (assuming US Currency ) expressed as a floating point number ( i.e. 1.25 or 0.75 )
returns that amount expressed as the least amount of change using the least number of bills, coins, or combination of bills and coins.
## To use as a gem:
```
gem install RubyChangeMaker
```
Then, in your source file:
```
require 'RubyChangeMaker'
cm = RubyChangeMaker::Change.new
amt = 1.25 # for $1.25, use 0.75 for .75 cents, etc.
dollars, cents = cm.make_change(amt)
```
To see an example program using the Module, look in this repo's **bin/** directory
## To work with the source files:
### To Run:
```
cd into bin/ and type: './changemaker' (the file is already chmod'd)
```
### To Run Tests:
```
(require's cucumber)
cd into root directory ( 'ruby-change-maker/' ), then type: cucumber
```
### NOTES:
* Source is in **lib/rubychangemaker/**.
* **lib/rubychangemaker.rb** is just some boot-strapping for cucumber.
* **features/support/** again, boot-strapping for cucumber.