|
10 | 10 | * program that prompts the user to enter the first 9 digits and displays the 10-digit ISBN
|
11 | 11 | * (including leading zeros). Your program should read the input as an integer. Here are sample
|
12 | 12 | * runs:
|
13 |
| - * <p>Enter the first 9 digits of an ISBN as integer: 013601267 The ISBN-10 number is 0136012671 |
14 |
| - * Enter the first 9 digits of an ISBN as integer: 013031997 The ISBN-10 number is 013031997X |
| 13 | + * <p>Enter the first 9 digits of an ISBN as integer: 013601267 |
| 14 | + * <p>The ISBN-10 number is 0136012671 |
| 15 | + * <p>Enter the first 9 digits of an ISBN as integer: 013031997 |
| 16 | + * <p>The ISBN-10 number is 013031997X |
15 | 17 | */
|
16 | 18 | package com.github.jonathanbirkey.chapter03;
|
17 | 19 |
|
@@ -45,9 +47,9 @@ public static void main(String[] args) {
|
45 | 47 | int checksum =
|
46 | 48 | (d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) % 11;
|
47 | 49 | if (checksum == 10) {
|
48 |
| - System.out.printf("%d%d%d%d%d%d%d%d%dX\n", d1, d2, d3, d4, d5, d6, d7, d8, d9); |
| 50 | + System.out.printf("The ISBN-10 number is %d%d%d%d%d%d%d%d%dX\n", d1, d2, d3, d4, d5, d6, d7, d8, d9); |
49 | 51 | } else {
|
50 |
| - System.out.printf("%d%d%d%d%d%d%d%d%d%d\n", d1, d2, d3, d4, d5, d6, d7, d8, d9, checksum); |
| 52 | + System.out.printf("The ISBN-10 number is %d%d%d%d%d%d%d%d%d%d\n", d1, d2, d3, d4, d5, d6, d7, d8, d9, checksum); |
51 | 53 | }
|
52 | 54 | }
|
53 | 55 | }
|
0 commit comments