Results 1 to 6 of 6
 10092010, 04:10 AM #1Member
 Join Date
 Oct 2010
 Posts
 4
 Rep Power
 0
Java program: ISBN calculated by other 9 digits?
Hi,
I need to create a program in which the 10th digit is the checksum. The program is to prompt the user to enter the first 9 digits and displays the 10 digit ISBN(including leading zeros). Last digit is denoted by an X. I have come up with this so far... But, I know I am still pretty far off. Could someone help me get this program going in the right direction.
Also thank you for all of those that were helping me with the JAVA pattern design. I am still working on it.
Thanks
Diana
Import java.util.scanner;
Public class ISBN {
public static void main(String [] args) {
Scanner input = new Scanner (System.in);
System.out.println ("Enter International Standard Book Number:");
int N = new Integer.parseInt(args [0]);
int sum = 0
for (int i = 2; i <=10; i++){
checksum = (d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) % 11;

 10092010, 04:42 AM #3Member
 Join Date
 Oct 2010
 Posts
 4
 Rep Power
 0
Hi
I got this formula from the book. I have looked elsewhere but have also found other ways it has been done as well. So, I am not sure how this formula fits into the formula.
Diana
 10092010, 05:13 AM #4Moderator
 Join Date
 Feb 2009
 Location
 New Zealand
 Posts
 4,716
 Rep Power
 17
The calculation looks OK  see the alternative calculation section of that wikipedia article.

 10092010, 05:22 AM #6Moderator
 Join Date
 Feb 2009
 Location
 New Zealand
 Posts
 4,716
 Rep Power
 17
OP: The important thing is that *you* understand the formula you are using. Do you? Can you explain in words how you are going to go about calculating the check digit?
Then  and only then  start writing code. Every line of your code should be deliberate and should express a small step in the plan you have already decided on. Don't just slap down bits of code and hope that they will add up to something.
Similar Threads

Digits of an integer.
By Allgorythm in forum New To JavaReplies: 8Last Post: 01012010, 02:34 AM 
can anyone tell my why this program bugs out when i enter more then 10 digits?
By sweetjava in forum New To JavaReplies: 3Last Post: 08192009, 03:54 AM 
ISBN Checker
By blobs86 in forum New To JavaReplies: 1Last Post: 03232009, 11:07 PM 
Formatting isbn number with Math.random()
By dns77x7 in forum New To JavaReplies: 11Last Post: 09212008, 06:02 PM
Bookmarks