What should the output be?
Are the formulas you are using to compute the checkdigit correct?
Do you get the correct result doing the math manually?
If not then ,maybe you need to get the correct...
Type: Posts; User: Norm
What should the output be?
Are the formulas you are using to compute the checkdigit correct?
Do you get the correct result doing the math manually?
If not then ,maybe you need to get the correct...
It can NOT assign a value because it does not change the initial value of -1.
Add a call to the println method (as suggest earlier in post#2) to print out a message with the values used to assign...
That means the code never assigns a value to checkDigit. Time for some debugging to see why it does not assign a value.
Where is the variable: checkDigit assigned a value? Is that line of code executed?
To see, change this line:
private int checkDigit = -1; //<<<<<<<<<<<
and see what prints...
Can you change the Scanner definition as I showed above in post #4 so that it provides the answers to the questions that the program asks. With that change there will be no chance a user can enter...
What prints out when the debugging println statements are executed?
Can you provide all the input that the user must make to test the program?
An easy way to make sure the program reads the...
Where is the code that creates that last digit? How have you tried to debug it so you'd understand why the digit is always 0? Add a println statement to print out the values of the variables used...