Skip to content

Commit bc1cf2a

Browse files
authored
Update CheckDigit.java
1 parent ea7f70a commit bc1cf2a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/main/java/CheckDigit.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ public class CheckDigit
88
public static int getCheck(int num)
99
{
1010
/* to be implemented in part (a) */
11+
int sum = 0;
12+
for(int i = 1; i <= getNumberOfDigits; i++){
13+
}
1114
}
1215

1316
/** Returns true if numWithCheckDigit is valid, or false
@@ -16,9 +19,13 @@ public static int getCheck(int num)
1619
* is between two and seven, inclusive.
1720
* numWithCheckDigit >= 0
1821
*/
19-
public static boolean isValid(int numWithCheckDigit)
20-
{
21-
/* to be implemented in part (b) */
22+
public static boolean isValid(int numWithCheckDigit){
23+
/* to be implemented in part (b) */
24+
int check = numWithCheck % 10;
25+
if(check == newCheck){
26+
return true;
27+
}
28+
return false;
2229
}
2330

2431
/** Returns the number of digits in num. */

0 commit comments

Comments
 (0)