-
Notifications
You must be signed in to change notification settings - Fork 0
/
Number.rb
83 lines (38 loc) · 1.06 KB
/
Number.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
def get_birth_path(dateofbirth)
num = dateofbirth[0].to_i + dateofbirth[1].to_i + dateofbirth[2].to_i + dateofbirth[3].to_i + dateofbirth[4].to_i + dateofbirth[5].to_i + dateofbirth[6].to_i + dateofbirth[7].to_i
num = num.to_s
num = num[0].to_i + num[1].to_i
if num > 9
num = num[0].to_i + num[1].to_i
end
return num
end
def get_message(birth_path_num)
case birth_path_num
when 1
message = "Your number is #{birth_path_num}."
when 2
message = "Your number is #{birth_path_num}."
when 3
message = "Your number is #{birth_path_num}."
when 4
message = "Your number is #{birth_path_num}."
when 5
message = "Your number is #{birth_path_num}."
when 6
message = "Your number is #{birth_path_num}."
when 7
message = "Your number is #{birth_path_num}."
when 8
message = "Your number is #{birth_path_num}."
when 9
message = "Your number is #{birth_path_num}."
else
message "Are you sure????"
end
end
puts "What is your DOB (mmddyyyy): "
dateofbirth = gets
birth_path_num = get_birth_path(dateofbirth)
message = get_message(birth_path_num)
puts message