Question: Write a Java program that takes in an account number (of any length) from the user without the check digit, and output the full account

Write a Java program that takes in an account number (of any length) from the user without the check digit, and output the full account number. Suppose you have the account number without the check digit as "792822". The way a check digit works is as follows:

Account Number w/o check digit: 7 9 2 8 2 2

With Step 1: 7 18 2 16 2 4

With Step 2: 7 9 2 7 2 4

Step 1: Double every other digit (notice that some may become two digit numbers).

Step 2: Sum up the digits of any two digit numbers so they are back to one digit (ex: 18 => 9), if they are already one digit you can leave them alone (ex: 7 => 7).

Step 3: Sum all of the single digits from Step 2 (7+9+2+7+2+4 => 31 for above example).

Step 4: Calculate check digit [checkDigit = (sum * 9) mod 10] (= 9 for above example, mod => %).

Result: Full account number includes check digit at the end (= "7927249" for above example).

Example of output through console (words inside quotation marks are what the console prints):

"Welcome to Check Digit Calculator!"

"A check digit is the last digit of a string of numbers that verifies"

"that the rest of the numbers are uncorrupted/unedited."

" "

"Please enter account number (without check digit): "792822 (as an example input)

" "

"Full Account Number = 7928229"

" "

"Thank you for using Check Digit Calculator!"

END

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!