Created
March 11, 2018 17:35
-
-
Save kat-perreira/3a69b99793f7e0d3cb8f01e99e65084f to your computer and use it in GitHub Desktop.
UPDATED Honeydukes Online Candy Store created by kaimana_Cat - https://repl.it/@kaimana_Cat/UPDATED-Honeydukes-Online-Candy-Store
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 | |
puts | |
puts "Welcome to the new Honeydukes online candy shop. Please enter your name:" | |
puts | |
name = gets.chomp | |
puts | |
puts | |
puts | |
puts | |
#Random generate money amount of 4 or 5, set up variable money | |
#All wizard currency is converted to US Dollars in accordance with Muggle validates_with | |
puts "Hello " + name + ", according to our records, you have an account here with a balance of " | |
puts | |
puts | |
wizmoney = rand(4..10) | |
print "$" | |
puts wizmoney.to_i | |
puts | |
puts | |
#Put in a Y or N for agreement to move forward in the Game. | |
#If login Y, Enter Menu, assign numeric integer value for letters | |
puts | |
puts | |
puts "Is this balance correct? Y or N" | |
login = gets.chomp | |
if login == "Y" || login == "y" | |
puts | |
puts | |
puts | |
puts | |
puts | |
puts "loading...." | |
puts | |
puts | |
puts | |
puts | |
puts | |
puts | |
puts "Wonderful! Here is our current selection avaliable for delivery:" | |
puts | |
puts | |
puts | |
puts | |
puts "*********MENU**********" | |
puts | |
puts "A--Bertie Bott's Every Flavor Beans.....$4.00" | |
puts | |
puts "B--Fizzing Whizzbees.....$4.00" | |
puts | |
puts "C--Chocolate Frogs (4 pack).....$5.00" | |
puts | |
puts "D--Sugar Quills (4 pack).....$5.00" | |
puts | |
puts "E--Pink Coconut Ice.....$6.00" | |
puts | |
puts "Please enter the letter selection" | |
choice = gets.chomp.upcase | |
#write out conditional statements around the following: | |
# A = 4 B = 4 C = 5 D = 5 E = $6 | |
#wizcandy variable in minus the amount of the candy | |
# incluce remaining balance or declined | |
if choice == "A" && wizmoney >= 4 | |
print "You have selected Bertie Botts Every flavor bean. Excellent choice! You have a remainin balance of: " | |
puts | |
print "$" | |
print "#{wizmoney - 4}" | |
print ".00" | |
puts | |
puts | |
print "Expect an owl with your package to arrive in 1-2 days. Thank you for shopping Honedukes online " | |
elsif choice == "B" && wizmoney >= 4 | |
print "You have selected Fizzing Whizzbees. Excellent choice! You have a remainin balance of: " | |
puts | |
print "$" | |
print "#{wizmoney - 4}" | |
print ".00" | |
puts | |
puts | |
print "Expect an owl with your package to arrive in 1-2 days. Thank you for shopping Honedukes online " | |
elsif choice == "C" && wizmoney >= 5 | |
print "You have selected Chocolate Frogs. Excellent choice! You have a remainin balance of: " | |
puts | |
print "$" | |
print "#{wizmoney - 5}" | |
print ".00" | |
puts | |
puts | |
print "Expect an owl with your package to arrive in 1-2 days. Thank you for shopping Honedukes online " | |
elsif choice == "D" && wizmoney >= 5 | |
print "You have selected a pack of Sugar Quills. Excellent choice! You have a remainin balance of: " | |
puts | |
print "$" | |
print "#{wizmoney - 5}" | |
print ".00" | |
puts | |
puts | |
print "Expect an owl with your package to arrive in 1-2 days. Thank you for shopping Honedukes online " | |
elsif choice == "E" && wizmoney >= 6 | |
print "You have selected Pink Coconut Ice. Excellent choice! You have a remainin balance of: " | |
puts | |
print "$" | |
print "#{wizmoney - 6}" | |
print ".00" | |
puts | |
puts | |
print "Expect an owl with your package to arrive in 1-2 days. Thank you for shopping Honedukes online " | |
else puts "I'm sorry, you don't have enough at this time. If you suspect a problem with your account please contact Gringots customer service" | |
end | |
else | |
login == "N" || login == "n" | |
puts "We've got Wrackspurts in the system...please refresh your browser and try again" | |
end | |
#Buy some jellybeans and eat them all in celebration of how awesome I am :D | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment