Skip to content

Commit

Permalink
p.59 added the method "frequent_renter_points" to Movie class.
Browse files Browse the repository at this point in the history
chenged the method "frequent_renter_points" in Rental class.
  • Loading branch information
kono committed Apr 11, 2010
1 parent cf4f2ed commit 4008efe
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions chapter1/Movie.rb
Expand Up @@ -9,6 +9,7 @@ class Movie
def initialize(title, price_code)
@title, @price_code = title, price_code
end

def charge(days_rented)
result = 0
case price_code
Expand All @@ -23,4 +24,8 @@ def charge(days_rented)
end
result
end

def frequent_renter_points(days_rented)
(price_code == NEW_RELEASE && days_rented > 1) ? 2 : 1
end
end

0 comments on commit 4008efe

Please sign in to comment.