-
Notifications
You must be signed in to change notification settings - Fork 0
/
54.rb
37 lines (29 loc) · 583 Bytes
/
54.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class Register
NAME = ['PENNY','NICKEL','DIME','QUARTER','HALF DOLLAR','ONE','TWO','FIVE','TEN','TWENTY','FIFTY','ONE HUNDRED']
VALUE_CASH =[ 0.01, 0.05, 0.1, 0.25, 0.5, 1, 2, 5, 10, 20, 50, 100 ]
name_to_value = {}
0.upto name.length-1 do
|i| name_to_value[VALUE_CASH[i]] = NAME[i]
end
def diff
PP.new(cash) - CH.new(cash)
end
end
module Sorter
change
class PP
attr_reader :cash
def initialize(cash)
@cash = cash
end
def change
@cash = 2
end
end
class CH
attr_reader :cash
attr
def initialize(cash)
@cash = cash
end
end