I'm recieving a ton of errors on my Java doc for an assignment I have can anyone help me fix them?
I'm recieving a ton of errors on my Java doc for an assignment I have can anyone help me fix them?
code:
package chapter.pkg6.part.pkg2.assignment;
/**
*
* @author matty
*/
public class Chapter6Part2Assignment {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// Method
long cardnumber = 4440967484181607L;
System.out.println("Please enter the card number/n");
System.out.println(cardnumber + " is " + (validitychk(cardnumber) ? "valid" : "invalid"));
// Return true if the card number is valid
public static boolean validitychk(long cnumber) {
return (thesize(cardnumber)>=13&& thesize(cnumber)<= 16)&&(prefixmatch(cardnumber, 4)
|| prefixmatch(cardnumber,5) || prefixmatch(cnumber,37) || prefixmatch(cardnumber, 6))
&& ((sumdoubleeven(cnumber) + sumodd(cnumber)) % 10 == 0);
}
public static int sumdoubleeven(long cardnumber) {
int sum = 0;
String num = cardnumber + "";
for (int i = thesize(cardnumber) - 2; i >= 0; i -= 2)
sum += getDigit(Integer.parseInt(num.charAt(i) + "") * 2);
return sum;
}
public static int getDigit(int cardnumber) {
if (cardnumber < 9)
return cardnumber;
return cardnumber / 10 + cardnumber % 10;
}
public static int sumodd(long cardnumber) {
int sum = 0;
String num = cardnumber + "";
for (int i = thesize(cardnumber) - 1; i >= 0; i -= 2)
sum += Integer.parseInt(num.charAt(i) + "");
return sum;
}
}
I attached an image of the code and the error issue as well.
Step by step
Solved in 3 steps with 4 images