Problem Statement
Imagine that the algorithm the IRS uses to determine who to audit is based on your social security number. The way it works is they start adding up the digits of the social security number to get partial sums (9 partial sums in all). Then they add up all the partial sums, and if that number is divisible by 11, you get audited. Here's an example: SS#: 041252467 partial sums: 0, 4, 5, 7, 12, 14, 18, 24, 31 sum of partial sums: 115 In this case, you would be spared from the IRS. Create a class Decoder than contains the method audit() that, given a social security number, returns a boolean indicating whether a person with that number would be audited. The input to audit() will be a String representing the social security number (excluding dashes) that consists of 9 integers (we'll do the data checking). Here is the method signature: // Precondition: This method takes a String input which must contain 9 exactly integers. // Postcondition: Returns a boolean indicating whether the string input would case this person to be audited. public boolean audit(String ssn);
Definition
- Class:
- Decoder
- Method:
- audit
- Parameters:
- String
- Returns:
- boolean
- Method signature:
- boolean audit(String param0)
- (be sure your method is public)
Constraints
Examples
No public sample cases were explicitly marked for this problem in the original data.