Last active
July 6, 2016 03:20
-
-
Save rightson/d2aa2766da946935a9173dab66823c8f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Rental... | |
double getCharge() { | |
double result = 0; | |
switch (getMovie().getPriceCode()) { | |
case Movie.REGULAR: | |
result += 2; | |
if (getDaysRented() > 2) | |
result += (getDaysRented() - 2) * 1.5; | |
break; | |
case Movie.NEW_RELEASE: | |
result += getDaysRented() * 3; | |
break; | |
case Movie.CHILDRENS: | |
result += 1.5; | |
if (getDaysRented() > 3) | |
result += (getDaysRented() - 3) * 1.5; | |
break; | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment