Lindsey and many others are using Hackety Hack to learn how to code.

Hackety Hack is a free program for Windows, Mac OS X and Linux that can teach you how to make games, applications and more and share those programs with your friends. You can ask other budding programmers questions and follow them to see what code they're working on through the Hackety Hack website.

Sign up Learn More

caffeine_counter by Lindsey

# caffeine calculator

# calculates approxmiately how much caffeine a person has had in a day



# ask the user for amounts of each
# convert to integer so we can do the math later
tea = Integer(ask "How many cups of tea have you had today?")

coffee = Integer(ask "How many cups of coffee have you had today?") 

drpepper = Integer(ask "How many cans of Dr. Pepper have you had today?")

mtdew = Integer(ask "How many cans of Mountain Dew have you had today?")



# calculate the caffeine total

total = (tea*47) + (coffee*95) + (drpepper*41) + (mtdew*54)



# tell the user how much they have had

alert "You have had " + total.to_s + "mg of caffeine"