inflation-calculator 0.0.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/inflation-calculator.rb +18 -8
  2. metadata +1 -1
@@ -105,26 +105,36 @@ class InflationCalc
105
105
  2011 => 224.939,
106
106
  2012 => 229.594,
107
107
  2013 => 232.957,
108
- 2014 => 233.916}
108
+ 2014 => 234.781}
109
109
  end
110
110
 
111
- def calculate
111
+ def get_amount
112
112
  print "Enter amount: "
113
- amount = gets.chomp
113
+ @amount = gets.chomp
114
+ end
115
+
116
+ def get_year
114
117
  print "Pick a year from 1913 to 2013: "
115
- year = gets.chomp.to_i
118
+ @year = gets.chomp.to_i
119
+
116
120
  while true
117
- if year < 1913 || year > 2013
121
+ if @year < 1913 || @year > 2013
118
122
  print "The year must be from 1913 to 2013. Enter year: "
119
- year = gets.chomp.to_i
123
+ @year = gets.chomp.to_i
124
+
120
125
  else
121
126
  break
122
127
  end
123
128
  end
124
- a = amount.to_d * (cpi[2014].to_d / cpi[year].to_d)
125
- puts "$#{amount} in #{year} has the same buying power as $#{a.to_f.round(2)} in 2014."
129
+ end
130
+
131
+ def calculate
132
+ a = @amount.to_d * (cpi[2014].to_d / cpi[@year].to_d)
133
+ puts "$#{@amount} in #{@year} has the same buying power as $#{a.to_f.round(2)} in 2014."
126
134
 
127
135
  end
128
136
  end
129
137
  f = InflationCalc.new
138
+ f.get_amount
139
+ f.get_year
130
140
  f.calculate
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inflation-calculator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: