Skip to content

Instantly share code, notes, and snippets.

@kat-perreira
Created February 10, 2018 03:49
Show Gist options
  • Save kat-perreira/e58a37e803fe4d84358d503f89f627e9 to your computer and use it in GitHub Desktop.
Save kat-perreira/e58a37e803fe4d84358d503f89f627e9 to your computer and use it in GitHub Desktop.
Honeydukes Online Candy Store created by kaimana_Cat - https://repl.it/@kaimana_Cat/Honeydukes-Online-Candy-Store
#####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..5)
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"
#Prompt user to enter selection based on letter choice
puts
puts
puts "Please enter the CAPITAL letter selection"
letter = gets.chomp
#write out conditional statements around the following:
# A = 4 B = 4 C = 5 D = 5 E = $6
#wizcandy 4 or 6
# incluce remaining balance or declined
if (wizmoney == 4) && (letter == "A")
puts "We have recieved your order! Your balance is $0.00. Expect a delivery owl with your order in 1-2 days. Thank you for shopping Honeydukes!"
elsif (wizmoney == 4) && (letter == "B")
puts "We have recieved your order! Your balance is $0.00. Expect a delivery owl with your order in 1-2 days. Thank you for shopping Honeydukes! "
elsif (wizmoney == 4) && (letter == "C")
print "We're sorry, your balance of $"
print wizmoney.to_i
print " is insufficent. Please contact Gringots to make a transfer."
elsif (wizmoney == 4) && (letter == "D")
print "We're sorry, your balance of $"
print wizmoney.to_i
print " is insufficent. Please contact Gringots if you suspect a problem."
elsif (wizmoney == 4) && (letter == "E")
print "We're sorry, your balance of $"
print wizmoney.to_i
print " is insufficent. Please contact Gringots if you suspect a problem."
end
if (wizmoney == 5) && (letter == "A")
puts "We have recieved your order, your balance is $1.00. Expect a delivery owl with your order in 1-2 days. Thank you for shopping Honeydukes!"
elsif (wizmoney == 5) && (letter == "B")
puts "We have recieved your order, your balance is $1.00. Expect a delivery owl with your order in 1-2 days. Thank you for shopping Honeydukes!"
elsif (wizmoney == 5) && (letter == "C")
puts "We have recieved your order, your balance is $0.00. Expect a delivery owl with your order in 1-2 days. Thank you for shopping Honeydukes!"
elsif (wizmoney == 5) && (letter == "D")
puts "we have recieved your order, your balance is $0.00. Expect a delivery owl with your order in 1-2 days. Thank you for shopping Honeydukes!"
elsif (wizmoney == 5) && (letter == "E")
print "We're sorry, your balance of $"
print wizmoney.to_i
print " is insufficent. Please contact Gringots if you suspect a problem."
end
#close conditional statement from asking if balance is correct
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