forked from jnappy/admin_exercise
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.rb
More file actions
63 lines (43 loc) · 1.86 KB
/
admin.rb
File metadata and controls
63 lines (43 loc) · 1.86 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
54
55
56
57
58
59
60
61
62
63
require 'pry'
#you run a site that offers a matching service between vendors selling laptops and customers
#..looking to purchase; you charge a fee to be listed as a vendor
#your site's users must sign in and if they are an admin they are able to make changes to the site
#######################################################
def user_permission(paid, cancelled, admin, signed_in)
if paid == "no" or cancelled == "yes"
puts "Go away!"
elsif admin == "yes" and signed_in == "yes"
puts "You can see and change all the pages!"
elsif admin == "no" and signed_in == "yes"
puts "You can see all the pages"
else
puts "You can't see any of the pages, please sign in!"
end
end
puts "Did you pay your Bill?"
puts "Yes or No"
user_paid = gets.strip.downcase
puts "Did you cancel you deal?"
puts "Yes or No"
user_cancelled = gets. strip.downcase
puts "Are you an Admin?"
puts "Yes or No"
user_admin = gets.strip.downcase
puts "Did you sign in?"
puts "Yes or No"
user_signed_in = gets.strip.downcase
user_permission(user_paid, user_cancelled, user_admin, user_signed_in)
#write a function "user_permission" that accepts four parameters: signed_in, admin, paid, and cancelled
#if the user doesn't pay their bills or has canceled a deal, show "go away!"
#if the user is signed in and they are an admin, show "you can see and change all the pages!"
#if the user is signed in but they are not an admin, show "you can see all the pages!"
#if the user is not signed in, show "you can't see any of the pages, please sign in!"
#ask the user if they pay their bills (yes/no)
#store their answer in a variable
#ask the user if they have cancelled a deal (yes/no)
#store their answer in a variable
#ask the user if they are an admin (yes/no)
#store their answer in a variable
#ask the user if they are signed in (yes/no)
#store their answer in a variable
#call the function