From f3bbf7b7594313d1ad006f5b44b2229351a28e6c Mon Sep 17 00:00:00 2001 From: Phil Park Date: Sun, 13 Mar 2016 16:24:05 -0400 Subject: [PATCH] completed admin exercise --- admin.rb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/admin.rb b/admin.rb index 06551b9..6b0f023 100644 --- a/admin.rb +++ b/admin.rb @@ -6,6 +6,38 @@ ####################################################### +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!"