Created
July 6, 2016 02:27
-
-
Save rightson/1921e171ac4dff583228803fc4202fb3 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 Customer... | |
private double amountFor(Rental aRental) { | |
double result = 0; | |
switch (aRental.getMovie().getPriceCode()) { | |
case Movie.REGULAR: | |
result += 2; | |
if (aRental.getDaysRented() > 2) | |
result += (aRental.getDaysRented() - 2) * 1.5; | |
break; | |
case Movie.NEW_RELEASE: | |
result += aRental.getDaysRented() * 3; | |
break; | |
case Movie.CHILDRENS: | |
result += 1.5; | |
if (aRental.getDaysRented() > 3) | |
result += (aRental.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