-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject_view.rb
More file actions
53 lines (50 loc) · 1.42 KB
/
project_view.rb
File metadata and controls
53 lines (50 loc) · 1.42 KB
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
def user_input(ruby_hash_response)
system "clear"
print_line = "💀 ❌ "*10
puts print_line
puts "\n\nWELCOME TO THE DEATH SEARCH\n\n\n"
puts "What sex are you searching for?"
puts "There is only data provided for male or female.\n\n"
puts "1. Male 👱"
puts "2. Female 👩\n\n"
sex_input = gets.chomp.to_i
until sex_input.between?(1,2)
puts "\nPlease enter 1 or 2"
sex_input = gets.chomp.to_i
end
system "clear"
puts print_line
puts "\n\nWhat race are you searching for?"
puts "There is only data provided for the following declared races/ethnicities.\n\n"
puts "1. Asian and Pacific Islander"
puts "2. Black Non-Hispanic"
puts "3. Hispanic"
puts "4. White Non-Hispanic"
puts "5. Not Stated/Unknown\n\n"
race_input = gets.chomp.to_i
until race_input.between?(1,5)
puts "\nPlease enter a number between 1 and 5."
race_input = gets.chomp.to_i
end
if sex_input == 1
sex = "M"
sex_print = "Males"
else
sex = "F"
sex_print = "Females"
end
if race_input == 1
race = "Asian and Pacific Islander"
elsif race_input == 2
race = "Black Non-Hispanic"
elsif race_input == 3
race = "Hispanic"
elsif race_input == 4
race = "White Non-Hispanic"
else race = "Not Stated/Unknown"
end
system "clear"
puts print_line
puts "\n\nThe leading causes of death for #{race} #{sex_print}:\n\n\n"
death(sex,race,ruby_hash_response)
end