-
Notifications
You must be signed in to change notification settings - Fork 1
/
CLUD.rb
65 lines (61 loc) · 1.54 KB
/
CLUD.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
require './voter.rb'
require './Create.rb'
require './Update.rb'
require './Delete.rb'
def get
gets.chomp.strip.capitalize
end
def border
puts "##" * 40
end
loop do
class VotingSimulation
puts "\n\nWelcome to the Voting Simulation! The fate of our country is in your hands!
\nWhat would you like to do? (C)reate, (L)ist, (U)pdate, or (D)elete a politician?"
action = get
until action == "C" || action == "L" || action == "U" || action == "D"
puts " Invalid choice"
action = get
end
case action
when "C"
border
puts " Would you like to create a (V)oter or a (P)olitician?"
c_choice = get
border
until c_choice == "P" || c_choice == "V" do
puts " You must choose a (V)oter or a (P)olitician"
c_choice = get
end
if c_choice == "V"
puts " You have chosen to Create a new Voter"
create_voter
else
puts " You have chosen to Create a new Politician"
create
end
when "L"
border
puts " Would you like to list (V)oters or (P)oliticians?"
lists = get
until lists == "P" || lists == "V" do
puts " Please choose (V)oters or (P)oliticians"
lists = get
end
if lists == "P"
puts "__________Politicians__________"
list_pol
else
"__________Voters__________"
list_voter
end
when "U"
border
update
else "D"
border
puts "What would you like to delete (V)oter or (P)olitician?"
delete
end
end
end