This file contains hidden or 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
# Request input from 3 trips for amount spent on lodging, transit, and amount of bags | |
# Create a blank hash for each spending category | |
lodging_spend = {} | |
transit_spend = {} | |
bags_spend = {} | |
total_spend ={} | |
3.times do |i| | |
i+=1 |
This file contains hidden or 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
# asks the user how many trips they've taken and prompts them that number of times | |
puts "How many trips did you take?" | |
trip_count = gets.chomp.to_i | |
# prompts the user the trip locations and stores them in a hash | |
trip_data = trip_count.times.map do |x| | |
puts "Where did you go for your trip ##{x+1}?" | |
trip_location = gets.chomp | |
puts "How much did you spend on lodging?" |
This file contains hidden or 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
# Trip one destination # | |
print "Hello, What was your destination for trip one? ==>" | |
trip_1 = gets.chomp | |
puts | |
# Trip one input # | |
print "Input round-trip transit expenses for your #{trip_1} trip ==> " | |
transit_1 = gets.chomp.to_f |