Created
July 6, 2016 02:10
-
-
Save rightson/4afe31223b9cc8f61a06e648ef34a335 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
| private double amountFor(Rental each) { | |
| double thisAmount = 0; | |
| switch (each.getMovie().getPriceCode()) { | |
| case Movie.REGULAR: | |
| thisAmount += 2; | |
| if (each.getDaysRented() > 2) | |
| thisAmount += (each.getDaysRented() - 2) * 1.5; | |
| break; | |
| case Movie.NEW_RELEASE: | |
| thisAmount += each.getDaysRented() * 3; | |
| break; | |
| case Movie.CHILDRENS: | |
| thisAmount += 1.5; | |
| if (each.getDaysRented() > 3) | |
| thisAmount += (each.getDaysRented() - 3) * 1.5; | |
| break; | |
| } | |
| return thisAmount; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment