compound_interest_calculator 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/compound_interest_calculator.rb +28 -0
- metadata +48 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3897fa2725c7bc2ea37205e27390c4b06134c63c
|
4
|
+
data.tar.gz: 649cca4c7299d5c824105d91e560d6adf03afffe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 978cf79fe1ed0db1bffc8820be2d61e03fc8ed2878509e48d0c4d033099a626a3571c460acb57f9ee8e85a0c05e476530cabdd1183284f236a30c8ae7f2fd970
|
7
|
+
data.tar.gz: 04bad680d2f87aed3cf9d003a3413baebbef2a8c7a6a14125a47c4d2ff1f18c8e62623c9628fd507545515ad16722c23db9926c341d4ef28fea0cedebc15e556
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class CompoundInterestCalculator
|
2
|
+
|
3
|
+
#Requests the principle amount.
|
4
|
+
puts "What's the initial amount you'd like to deposit?"
|
5
|
+
puts "Please type the amount below without commas or dollar signs."
|
6
|
+
principle = gets.to_f
|
7
|
+
|
8
|
+
#Requests the annual interest rate.
|
9
|
+
puts "What will the annual interest rate be?"
|
10
|
+
puts "Please leave the percentage sign off (i.e. 16% would be written as 16)."
|
11
|
+
interest = (gets.to_f/100)
|
12
|
+
|
13
|
+
#Requests the number of times the principle will be compounded each year.
|
14
|
+
puts "How many times will the deposit be compounded each year?"
|
15
|
+
compound = gets.to_i
|
16
|
+
|
17
|
+
#Requests the amount of years that compound interest will take place.
|
18
|
+
puts "How many years will the deposit be compounded?"
|
19
|
+
time = gets.to_i
|
20
|
+
|
21
|
+
#Prints the final amount accumulated.
|
22
|
+
amount = (principle*(1 + interest/compound)**(compound*time)).round(2)
|
23
|
+
|
24
|
+
puts "You'll have $#{amount} after #{time} years."
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: compound_interest_calculator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brandon LaFave
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: 'This gem calculates the amount of money earned over time through compound
|
14
|
+
interest. It requests user input for the following values: time (in years), annual
|
15
|
+
rate of interest, principle amount, and the number of times the principle amount
|
16
|
+
will be compounded each year. The program works, but the rspec tests don''t pass
|
17
|
+
yet.'
|
18
|
+
email: lafaveb@gmail.com
|
19
|
+
executables: []
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- lib/compound_interest_calculator.rb
|
24
|
+
homepage: http://rubygems.org/gems/compound_interest_calculator
|
25
|
+
licenses:
|
26
|
+
- MIT
|
27
|
+
metadata: {}
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
require_paths:
|
31
|
+
- lib
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
requirements: []
|
43
|
+
rubyforge_project:
|
44
|
+
rubygems_version: 2.2.1
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
47
|
+
summary: A gem that calculates compound interest over time.
|
48
|
+
test_files: []
|