lib/car.rb
# Compute how cost-effective the fun rating is for this car.
# This is computed in terms of unit horsepower per TCO dollar * 1000000.
# @param features [String] Either 'min' or 'loaded'.
Compute how cost-effective the fun rating is for this car.
This is computed in terms of unit horsepower per TCO dollar * 1000000.
Compute how cost - effective the fun rating is for this car . This is computed in terms of unit horsepower per TCO dollar * 1000000 .
def giga_funs(features='min', gas_type='regular', miles = 100000)
    fun = unit_horsepower
    base_cost = @specs["msrp_#{features}"]
    gas_cost = total_gas_cost(gas_type, miles, 'city')
    return 0 if fun.nil? || base_cost.nil? || base_cost.to_i == 0 || base_cost == 'NULL'
    (fun.to_f * 1000000000 / (base_cost.to_f + gas_cost)).round(1)
  end
def giga_funs ( features = 'min' , gas_type = 'regular' , miles = 100000 ) fun = unit_horsepower base_cost = @specs [ "msrp_#{features}" ] gas_cost = total_gas_cost ( gas_type , miles , 'city' ) return 0 if fun . nil? || base_cost . nil? || base_cost . to_i == 0 || base_cost == 'NULL' ( fun . to_f * 1000000000 / ( base_cost . to_f + gas_cost ) ) . round ( 1 ) end
Compute how cost-effective the fun rating is for this car.
Compute how cost - effective the fun rating is for this car .
features
Either 'min' or 'loaded'.
Either ' min ' or ' loaded ' .
gas_type
miles