adric: books icon (c) 2004 adric.net (Default)
adric ([personal profile] adric) wrote2008-06-02 12:45 am

Ruby is against me going

>> @gas_price = 4.00
=> 4.0
>> @atl_bos = 1076
=> 1076
>> @hotel_nights = 6
=> 6
>> @hotel_fee = 60
=> 60
>> @tank_size=14.50
=> 14.5
>> @miles_per_gallon=20
=> 20
>> @roundtrip = 2*@atl_bos
=> 2152
>> @range = @tank_size * @miles_per_gallon
=> 290.0
>> @tank = @tank_size * @gas_price
=> 58.0
>> @tank = @tank_size * @gas_price
=> 58.0
>> @range = @tank_size * @miles_per_gallon
=> 290.0
>> @gas_buys =  @roundtrip / @range
=> 7.42068965517241
>> (@hotel_fee * @hotel_nights) + (@gas_buys * @tank)
=> 790.4

I'm not sure the exact value of @prohibatively_expensive but ..

[livejournal.com profile] arie pointed out an error in the math, recalculating:

>> @hotel_nights = 7
=> 7
>> (@hotel_fee * @hotel_nights) + (@gas_buys * @tank)
=> 850.4
arie: (Default)

[personal profile] arie 2008-06-02 04:55 am (UTC)(link)
This may be a stupid question, but why 6 nights of hotels? When I drove from Atlanta to (roughly) Boston, I did it in two days. So one hotel night (though technically I stayed at a relative's house and not a hotel...).

ETA: Roundtrip of 2 hotel nights -- one each way.
Edited 2008-06-02 04:56 (UTC)
arie: (Default)

Re: It's not like me not to comment my code, lol

[personal profile] arie 2008-06-02 05:00 am (UTC)(link)
Glad to help! ;D