Last active
December 19, 2015 06:58
-
-
Save denniskeefe/5914791 to your computer and use it in GitHub Desktop.
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
avg_fuel_economy = 22 | |
avg_fuel_price = 3.60 | |
avg_fuel_price.to_f | |
#make sure we're calculating float and float in cost below | |
print "How many miles will you travel?" | |
distance = gets.chomp | |
puts "Distance as input: #{distance}" | |
distance = distance.to_f | |
puts "Distance as float: #{distance}" | |
cost = (distance * avg_fuel_price) / avg_fuel_economy | |
puts "Cost: #{cost}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment