Created
October 13, 2016 13:33
-
-
Save ryanveroniwooff/0a4188f09d61016159fa60d64cb44367 to your computer and use it in GitHub Desktop.
Quiz #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Spider | |
attr_accessor :totalSpiders | |
def initialize (totalSpiders) | |
@totalSpiders = totalSpiders | |
end | |
def spinWeb | |
#make spiders spin web | |
puts "#{totalSpiders} spiders began to spin webs.." | |
end | |
def bark | |
puts "Lookout! One of those is a barking spider!" | |
#insert bad dad joke here | |
puts "\*loud fart\*" | |
end | |
def destroyAllHumans | |
puts "They are going to destroy us!" | |
#make spiders organize and systematically wipe us out | |
puts "The world was destroyed and you got eaten by #{totalSpiders} spiders!" | |
end | |
end | |
#get number of spiders | |
puts "How many spiders are there: " | |
totalSpiders = gets.chomp.to_i | |
#setup new spider instance | |
spider = Spider.new(totalSpiders) | |
#call to spinWeb | |
spider.spinWeb | |
#call to bark | |
spider.bark | |
#call to destroyAllHumans | |
spider.destroyAllHumans |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment