Question: Write a program that prompts the user for a file containing ISBN numbers and then checks if each the ISBN is correct. Here is a

Write a program that prompts the user for a file containing ISBN numbers and then checks if each the ISBN is correct. Here is a complete description of what I want you to do: In main: Create a Scanner to read in the name of the input file as a String. Call a method createScanner with the parameter of the String file. createScanner should return a reference to a scanner that allows you to read from the input file. For each ISBN code in the file Read in the potential ISBN codes one at a time as a StringBuilder. Call checkISBN with the reference to StringBuilder object you have read in. checkISBN returns a String reference with a message telling whether this is a valid code, and if not why not. Print the message to the screen , along with the ISBN number entered. (see sample output when using the file I have provided). Close the Scanner used to read he file. In createScanner: Accept the reference to the file name as a String. Create a Scanner object that reads from that file. Be sure to check for the files existence. Return a reference to the created Scanner In checkISBN: Perform the following checks. If a check leads to an error, return a message listing the error. Below is my suggested order. Here are steps you may follow: Check that total length is 13. Make sure the 12th position is a digit or X Make sure that there are exactly three - in the code. Check to make sure that each character except the last is a digit or a dash. Extract the nine digits in order 6 Calculate the check digit. If the check digit matches as described above return a message indicating a good ISBN, otherwise return a message indicating that a bad ISBN was created because the digit doesnt match. needs to be in JAVA.

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!