5 Replies - 2725 Views - Last Post: 29 April 2012 - 01:36 PM Rate Topic: -----

#1 norrisdjavan  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 29-April 12

Calculate ISBN check digit

Posted 29 April 2012 - 12:52 PM

Hi all I'm brand new to this forum and java itself. I'm in a huge bind and can't seem to figure this out. My assignment is asking me to prompt for 10 ISBN numbers using static methods. I've accepted the input as string, and am trying to use char to access each of the characters. I know I must use a loop as well as get their numerical values, then calculate each one. I just can't figure out which goes where? Any help is greatly appreciated...

Is This A Good Question/Topic? 0
  • +

Replies To: Calculate ISBN check digit

#2 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3101
  • View blog
  • Posts: 19,141
  • Joined: 14-September 07

Re: Calculate ISBN check digit

Posted 29 April 2012 - 01:00 PM

Welcome to Dream.In.Code! You may find some good reference material in the snippet section of the website.

Here are a couple examples of ISBN code snippets [13 digit java/10 digit C++]. Additionally this is less of a programming language issue, more algorithmic. The math can be found here. In the future, please keep in mind that forum rules require a good faith effort on your part before assistance is rendered.
Was This Post Helpful? 0
  • +
  • -

#3 norrisdjavan  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 29-April 12

Re: Calculate ISBN check digit

Posted 29 April 2012 - 01:03 PM

Thank you and I apologize, should I have put my code up specifically to identify the issues I am having?
Was This Post Helpful? 1
  • +
  • -

#4 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3101
  • View blog
  • Posts: 19,141
  • Joined: 14-September 07

Re: Calculate ISBN check digit

Posted 29 April 2012 - 01:05 PM

Yes, that way we can help with the issues you're actually having rather then the generic ISBN problem itself.
Was This Post Helpful? 0
  • +
  • -

#5 norrisdjavan  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 29-April 12

Re: Calculate ISBN check digit

Posted 29 April 2012 - 01:13 PM

I've attempted to make a method that will capture the values of String ISBN = console.nextLine that looks like this.

public static int checkDigit (String ISBN) {

for (int i = 0; i < ISBN.length(); i++) {
char c = ISBN.charAt(i);

Am I missing something that will not enable me to get the values of the input?
Was This Post Helpful? 0
  • +
  • -

#6 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3101
  • View blog
  • Posts: 19,141
  • Joined: 14-September 07

Re: Calculate ISBN check digit

Posted 29 April 2012 - 01:36 PM

No, that's the gist. If that is not working, post the entire snippet that is compilable/runnable.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1