Question
The International Standard Book Number (ISBN) is a numeric book identifier found in published books. For instance, Harry Potter and the Chamber of Secrets is
The International Standard Book Number (ISBN) is a numeric book identifier found in published books. For instance, Harry Potter and the Chamber of Secrets is assigned to ISBN 978-0439064873 Harry Potter and the Prisoner of Azkaban is assigned to ISBN 978-0439136365 The last digit of an ISBN-13 is a check digit based on the first 12 digits. Write a program named ISBNChecker that verifies an ISBN-13 check digit. Your program must prompt the user for the ISBN, then inform them if the check digit is correct. If not, display a message and the correct check digit. Your program must continue accepting ISBNs until the user enters "stop", which could be entered in any mix of upper and lower case. Input from the user will be digits without hyphens. For example, the user would enter 9780439136365and not 978-0439136365. The algorithm for the ISBN check digit requires the first 12 digits (from left to right) to be multiplied by the alternating values 1, 3, 1, 3, ... etc. e.g. (from Wikipedia): To get the corresponding integer value from a char, subtract 48. E.g. char c = '1'; int i = c - 48; System.out.println(i); Sample output: Enter ISBN-13s (stop to end) 9780439136365 Check digit is correct 9780439136363 Check digit is incorrect (should be 5) 8675309 ISBN-13 must have 13 digits 9780439785969 Check digit is correct stop *** end of program ***
Step by Step Solution
3.39 Rating (149 Votes )
There are 3 Steps involved in it
Step: 1
Here is a sample Java program named ISBNChecker that verifies an ISBN13 check digit based on ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started