Skip to content

Instantly share code, notes, and snippets.

View solomoncarnes's full-sized avatar

solomoncarnes

View GitHub Profile
@solomoncarnes
solomoncarnes / gist:9f682070c5bdda23ffe5c81543dfa8ae
Created April 3, 2020 22:23
Trip Expense Calculator (Three defined trips)
# 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
@solomoncarnes
solomoncarnes / gist:08ce364669b763e01e601f4707afeb1f
Created April 3, 2020 22:20
Trip Calculator (No defined number of trips)
# 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?"
@solomoncarnes
solomoncarnes / gist:de32e70afa92e1fcf083137fabeab360
Last active September 21, 2020 23:33
Travel Tracker (Original)
# 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