Sha256: 62a4596fe97ad8e6be2b2a49b5b3918bbb153a1dd1aaee696a78b4a3e89444e5

Contents?: true

Size: 579 Bytes

Versions: 1

Compression:

Stored size: 579 Bytes

Contents

module LemonadeStand

  class Result

    attr_reader :glasses_sold
    attr_reader :choice
    attr_reader :day

    def initialize data
      @glasses_sold = data[:glasses_sold]
      @choice       = data[:choice]
      @day          = data[:day]
    end

    def income
      (@glasses_sold * @choice.price_per_glass).round 2
    end

    def expenses
      glasses_cost = @choice.glasses_made * @day.cost_per_glass
      signs_cost   = 15 * @choice.signs
      (glasses_cost + signs_cost).round 2
    end

    def profit
      (income - expenses).round 2
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lemonade_stand-0.0.1 lib/lemonade_stand/result.rb