Skip to content

Instantly share code, notes, and snippets.

@edwardbeckett
Created February 27, 2013 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edwardbeckett/5046554 to your computer and use it in GitHub Desktop.
Save edwardbeckett/5046554 to your computer and use it in GitHub Desktop.
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