From 0e6ff43d64816609db417d50b3ab2b155772eecd Mon Sep 17 00:00:00 2001 From: Kathy Date: Sun, 19 Jun 2016 17:15:28 -0400 Subject: [PATCH] phoebe's admin exercise --- admin.rb | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/admin.rb b/admin.rb index 94762f2..21bf7d5 100644 --- a/admin.rb +++ b/admin.rb @@ -12,22 +12,41 @@ #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!" +def user_permission(bill_paid,deal_cancelled,user_admin,user_signed_in) + if bill_paid == "no" or deal_cancelled == "yes" + puts("go away!") + elsif user_signed_in == "yes" and user_admin == "yes" + puts("you can see and change all the pages!") + elsif user_signed_in == "yes" and user_admin == "no" + puts("you can see all the pages!") + elsif + puts("you can't see any of the pages, please sign in!") + end +end + #ask the user if they pay their bills (yes/no) +puts("have you paid your bills? (yes/no)") #store their answer in a variable +bill_paid = gets.strip #ask the user if they have cancelled a deal (yes/no) +puts("have you cancelled a deal? (yes/no)") #store their answer in a variable +deal_cancelled = gets.strip #ask the user if they are an admin (yes/no) +puts("are you an admin? (yes/no)") #store their answer in a variable +user_admin = gets.strip #ask the user if they are signed in (yes/no) +puts("are you signed in? (yes/no)") #store their answer in a variable - - +user_signed_in = gets.strip #call the function!! +user_permission(bill_paid,deal_cancelled,user_admin,user_signed_in) \ No newline at end of file