File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff 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. */
You can’t perform that action at this time.
0 commit comments