-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLuhn.java
More file actions
43 lines (37 loc) · 1.19 KB
/
Luhn.java
File metadata and controls
43 lines (37 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
*
* A utility class providing methods related to Luhn values.
*
*/
public final class Luhn {
// hide the constructor
private Luhn() {}
/**
* Determine whether the integer provided satisfies the Luhn
* algorithm.
*
* @param toBeTested the number to check for compliance
*
* @return true, if the number is valid; false, otherwise
*
*/
public static boolean checkValid(int toBeTested) {
//to be implemented
}
/**
* Given an arbitrary int value, determine the rightmost check digit that
* when added as the least significant bit will result in a new number,
* one digit longer, that forms a valid Luhn number.
*
* @param incomplete a number lacking a check digit
*
* @return a single digit that when concatenated onto the right side of the
* parameter supplied will result in a valid Luhn number.
*/
public static int generate(int incomplete) {
// to be implemented
}
// If you wish to write additional method headers and implement them
// (perhaps to handle String or long arguments, for example), please do so
// in the space below.
}