Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Final Project by Kevin Vieira#
- monitor = rand(10) #Random integers
- keyboard = rand(15)
- puts 'Sign in mode beginning'
- puts '-'*30
- username = [["admin"], ["guest"]] #Array
- puts "Are you an admin or a guest" #Multidimensional Array
- input = gets.chomp
- if input == username[0][0] or input == username[1][0] #What gets you it.
- puts "Now to the password."
- else
- puts "Wrong. Please Leave"
- abort #Exits
- end
- password = [["football"],["soccer"]] #Another Array
- puts "Enter password."
- userinput = gets.chomp
- if userinput == password[0][0] or userinput == password[1][0]
- puts "Your in. You can enter:"
- else
- puts "Denied. Please Leave."
- abort
- end
- puts '-'*30
- puts """
- Welcome to the program!
- """
- puts """
- Let's do a check to see if you are able to access this.
- """
- puts '-'*30
- def check(number, tool) #tool is used as a place holder
- if number > 1 #arbitrary number to continue
- puts "It works. Congrats!" #Now you can move on.
- else
- puts "#{tool} isn't working. Goodbye."
- abort #Leaves
- end
- end
- puts monitor, "monitor ^" #Prints the number.
- puts keyboard, "keyboard ^"
- check(monitor,"Monitor" ) #Calls to the function.
- check(keyboard,"Keyboard")
- puts '-'*30
Add Comment
Please, Sign In to add comment