@anonymous/QuickwittedHarmfulApisdorsatalaboriosa
Ruby

No description

repl talk
Files
  • main.rb
main.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
user = {
  "ninjex" => {
    :dob => '06/17/1993',
    :ssn => '318-67-8892',
    :sex => 'male',
  },
  "mshred" => {
    :dob => '01/26/1982',
    :ssn => '201-57-1677',
    :sex => 'male',
  },
  "limdis" => {
    :dob => '07/07/1990',
    :ssn => '867-12-4228',
    :sex => 'male',
  }
}

found = false
while found != true
  puts "Enter your name:"
  print '> '
  name = gets.chomp.downcase
  if user.include?(name)
    puts "Hello, #{name}"
    puts "Date of birth: #{user[name][:dob]}"
    puts "Social Security Number: #{user[name][:ssn]}"
    puts "Gender: #{user[name][:sex]}"
    found = true
  else
    puts "User: #{name} was not found in the database."
    puts "We can add you to our database."
    puts "#{name}, what is your date of birth?"
    print '> '
    dob = gets.chomp
    puts "What is your Social Security Number?"
    print '> '
    ssn = gets.chomp
    puts "What is your gender?"
    sex = gets.chomp
    user[name] = {
      :dob => dob,
      :ssn => ssn,
      :sex => sex
    }
  end
end
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]