Class: Eg::Book::Discount

Inherits:
Object
  • Object
show all
Defined in:
lib/eg/book/calculate_discount.rb

Instance Method Summary collapse

Instance Method Details

#get_discount(amount) ⇒ Object

A 5 percent discount is provided whenever the total purchase is greater than $1,000



19
20
21
# File 'lib/eg/book/calculate_discount.rb', line 19

def get_discount amount
  (amount >= 1000) ? (amount / 100.0) * 5 : 0.0
end