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
#This is a practice for Ruby Lesson 9 in the Ada Jumpstart program | |
#Introduce the game | |
puts "Hello and Welcome to my SuperHero MadLibs! Please tell me your name:" | |
User = gets.chomp | |
puts "Hello " + User + ", please enter following: " | |
#Collect Variables for Story |
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
#####Project from Lesson 10 Ada, Candy Machine Game#### | |
#Greeting, prompt to ask for witch/wizard's name | |
puts | |
puts | |
puts "- HONEYDUKES ONLINE- Selling Candy to the Wizarding World since 1641-" | |
puts | |
puts "*Please note, in accordance with Muggle internet laws, all wizarding currancy must be converted to US Dollars. At this time, the exchange rate is: 1 Sickle = $0.39 USD" | |
puts |
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
#####Poll ##### | |
puts "What is your favorite type of fruit? I will collect ten votes" | |
#Get user input, store the entered values into a hash. | |
#Build hashmap for TWO VALUES, FOR NAME AND FOR COUNT | |
#Try to implement DRY |
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
=begin | |
Practice: Write a command line program that asks the user for the year they were born, | |
then calculates their age in years, days, and seconds. | |
Tell the user how old they are in these different formats. | |
(Note: you'll be using 'gets' and 'puts' in this program, along with some math) | |
=end | |
# Ask year user name | |
puts "Please enter your name:" |
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
=begin | |
write a program that prints lyrics to 99 bottles of beer on the wall | |
Make it Harry Potter Themed | |
=end | |
99.downto(0) { |n| puts n, " Berties Botts Beans in a bag, " | |
puts n, " Berties Botts Beans! Take one down, try not to gag, " |
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
=begin | |
write a program that prints lyrics to 99 bottles of beer on the wall | |
Make it Harry Potter Themed | |
=end | |
puts "Hello, would you like to take the Bertie Bots Every Flavor Bean Challange?" | |
print "Y or N:" | |
answer = gets.chomp |
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
=begin | |
Write a Deaf Grandma program. Whatever you say to grandma (whatever you type in), she should respond with HUH?! SPEAK UP, SONNY!, unless you shout it (type in all capitals). If you shout, she can hear you (or at least she thinks so) and yells back, NO, NOT SINCE 1938! To make your program really believable, have grandma shout a different year each time; maybe any year at random between 1930 and 1950. (This part is optional, and would be much easier if you read the section on Ruby's random number generator at the end of the methods chapter.) You can't stop talking to grandma until you shout BYE. | |
Hint: Don't forget about chomp! 'BYE'with an Enter is not the same as 'BYE' without one! | |
Hint 2: Try to think about what parts of your program should happen over and over again. All of those should be in your while loop. | |
=end | |
# Ask user to say a spell. accept as user_input | |
puts "Please enter your name" |
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
#####Project from Lesson 10 Ada, Candy Machine Game#### | |
#Greeting, prompt to ask for witch/wizard's name | |
puts | |
puts | |
puts "- HONEYDUKES ONLINE- Selling Candy to the Wizarding World since 1641-" |
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
#This is a practice for Ruby Lesson 9 in the Ada Jumpstart program | |
puts "Welcome to SuperHero MadLibs!" | |
puts "Please tell me your name:" | |
User = gets.chomp | |
puts | |
puts | |
puts "Hello " + User + ", please choose the following: " |
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
#Collect user input | |
puts "**********************************" | |
puts "Magical Madlibs--Harry Potter Edition" | |
puts "***********************************" | |
print "Enter your name: " | |
user_name = gets.chomp | |
print "Now enter the name of a friend: " | |
friend_name = gets.chomp |
OlderNewer