Skip to content

Commit

Permalink
p.67 passed tests and checked by rcov.
Browse files Browse the repository at this point in the history
  • Loading branch information
kono User committed Apr 25, 2010
1 parent 57c1580 commit c9804e8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions chapter1/Movie.rb
Expand Up @@ -23,8 +23,7 @@ def charge(days_rented)
result = 0
case price_code
when REGULAR
result += 2
result += (days_rented - 2) * 1.5 if days_rented > 2
return @price.charge(days_rented)
when NEW_RELEASE
result += days_rented * 3
when CHILDRENS
Expand All @@ -40,6 +39,11 @@ def frequent_renter_points(days_rented)
end

class RegularPrice
def charge(days_rented)
result = 2
result += (days_rented -2)*1.5 if days_rented >2
result
end

end

Expand Down

0 comments on commit c9804e8

Please sign in to comment.