Question: 1. Write a program ISBNChecksum.java that takes a 9-digit int as a command-line argument and displays the checksum digit according to the following rules: (IN

1. Write a program ISBNChecksum.java that takes a 9-digit int as a command-line argument and displays the checksum digit according to the following rules: (IN JAVA PLEASE)

  • Multiply the first digit by 10, the second by 9, the third by 8, and so on, down to the ninth digit by 2.
  • Add the values together.
  • Divide the sum by 11. What is the remainder?
  • If the remainder is 0, the checksum is 0; otherwise, subtract the remainder from 11 to get the checksum digit.
  • If the checksum that you come up with is 10, then X is used as the checksum digit!
  • As an example, the checksum digit corresponding to 020131452 is 5 since 5 is the only value of x between 0 and 10 for which10*0 + 9*2 + 8*0 + 7*1 + 6*3 + 5*1 + 4*4 + 3*5 + 2*2 + 1*x is a multiple of 11.
  • Hint 1: to extract the rightmost digit of a number use the modulus operator.
  • Hint 2: to remove the rightmost digit of a number use the integer division by 10
  • Hint 3: for full credit use a loop to compute the sum
  • Assume the input value used to test your program is a 9-digit positive integer. Also assume that the input is a valid ISBN number without the checksum digit.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!