Created
February 27, 2013 09:17
-
-
Save edwardbeckett/5046554 to your computer and use it in GitHub Desktop.
This file contains 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
public class Disks { | |
public int total, labels = 26, singleDigits, count; | |
/** | |
* We know there are only ten labeled disks that have 10 or less disks in the collection. | |
*/ | |
public int getSingleDigitTotal() { | |
do { | |
singleDigits += count; | |
count++; | |
} while( count <= 9 ); | |
return singleDigits; | |
} | |
public int getCount() { | |
return count; | |
} | |
/** | |
* Simple method to return count min single digits. | |
* @return int :: Total ~ SDT 45 - labels + 26 count ~ 10 | |
*/ | |
public int getRemainingDisks() { | |
total = 9 + getSingleDigitTotal() + ( (labels - getCount()) * 9 ); | |
return Math.round( total + 1 ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment