From 8ee0c0745f3670efa2b596b1416f4c15a0dae766 Mon Sep 17 00:00:00 2001 From: Nissa Eberly Date: Sun, 21 Feb 2016 15:15:49 -0500 Subject: [PATCH 1/2] i give up --- admin.rb | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/admin.rb b/admin.rb index c751799..54b5773 100644 --- a/admin.rb +++ b/admin.rb @@ -1,7 +1,29 @@ 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 +def "matching service for vendors and customers" + puts("Are you looking for matching service? Please answer 'yes' or 'no'") + user_answer = gets.strip.downcase + if user_answer.include =='yes' + puts("Are you signed in?") + if user_answer.include =='yes' + puts(user_permission = signed_in, admin, paid and canceled) + if user_answer for paid == 'no' + puts("go away") + if user_answer for signed_in == 'yes'and admin == 'yes' + puts("you can see and change all the pages") + if user_answer for signed_in == 'yes' and admin == 'no' + puts("you can see all the pages") + if user_answer for signed_in == 'no' + puts("you can't see any of the pages, please sign in!") + end + puts("Have you paid your bills? Please answer 'yes or 'no'") + + + user_permission + + +#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 ####################################################### @@ -28,4 +50,4 @@ #store their answer in a variable -#call the function +#call the function From a2a9d7ce275ee1a195fb6c1acf97684c36367665 Mon Sep 17 00:00:00 2001 From: Nissa Eberly Date: Sun, 21 Feb 2016 15:36:42 -0500 Subject: [PATCH 2/2] i tried it again --- admin.rb | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/admin.rb b/admin.rb index 54b5773..8b8c30a 100644 --- a/admin.rb +++ b/admin.rb @@ -1,25 +1,31 @@ require 'pry' -def "matching service for vendors and customers" - puts("Are you looking for matching service? Please answer 'yes' or 'no'") - user_answer = gets.strip.downcase - if user_answer.include =='yes' - puts("Are you signed in?") - if user_answer.include =='yes' - puts(user_permission = signed_in, admin, paid and canceled) - if user_answer for paid == 'no' +def user_permission(signed_in, admin, paid, canceled) + if paid == 'no' or canceled =='yes' puts("go away") - if user_answer for signed_in == 'yes'and admin == 'yes' + elsif signed_in == 'yes'and admin == 'yes' puts("you can see and change all the pages") - if user_answer for signed_in == 'yes' and admin == 'no' + elsif signed_in == 'yes' and admin == 'no' puts("you can see all the pages") - if user_answer for signed_in == 'no' + elsif signed_in == 'no' puts("you can't see any of the pages, please sign in!") end - puts("Have you paid your bills? Please answer 'yes or 'no'") + end - - user_permission + #ask the user if they pay their bills (yes/no) + puts("Have you paid your bills? Please answer 'yes' or 'no'") + user_paid = gets.strip.downcase + + puts("Have you canceled a deal? Please answer 'yes' or 'no'") + user_canceled = gets.strip.downcase + + puts("Are you an admin? Please answer 'yes' or 'no'") + user_admin = gets.strip.downcase + + puts("Are you signed in? Please answer 'yes' or 'no'") + user_signed_in = gets.strip.downcase + + user_permission(user_signed_in,user_admin,user_paid, user_canceled) #you run a site that offers a matching service between vendors selling laptops and customers @@ -34,7 +40,6 @@ def "matching service for vendors and customers" #if you 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