Last active
July 6, 2016 03:25
-
-
Save rightson/3e514e17d459945f03de280bee7da4af 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 Movie... | |
| double getCharge(int daysRented) { | |
| double result = 0; | |
| switch (getPriceCode()) { | |
| case Movie.REGULAR: | |
| result += 2; | |
| if (daysRented > 2) | |
| result += (daysRented - 2) * 1.5; | |
| break; | |
| case Movie.NEW_RELEASE: | |
| result += daysRented * 3; | |
| break; | |
| case Movie.CHILDRENS: | |
| result += 1.5; | |
| if (daysRented > 3) | |
| result += (daysRented - 3) * 1.5; | |
| break; | |
| } | |
| return result; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment