1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
USPshnik [31]
3 years ago
9

ISBN-13 is a new standard for identifying books. It uses 13 digits d1d2d3d4d5d6d7d8d9d10d11d12d13. The last digit d13 is a check

sum, which is calculated from the other digits using the following formula: 10 - (d1 3d2 d3 3d4 d5 3d6 d7 3d8 d9 3d10 d11 3d12) % 10 If the checksum is 10, replace it with 0. Your program should read the input as a string.

Computers and Technology
1 answer:
qwelly [4]3 years ago
5 0

Answer:

// Scanner class is imported to allow program

// read input from user

import java.util.Scanner;

// Solution class is created

public class Solution {

// main method that begin program execution

public static void main(String[] strings) {

// Scanner object scan is created

// it receive input via the keyboard

Scanner scan = new Scanner(System.in);

// a prompt is displayed for user to enter 12 digits of ISBN

System.out.print("Enter the first 12 digits of an ISBN as string: ");

// user input is assigned to input

String input = scan.next();

//if length of input is not 12, program display error message and quit

if (input.length() != 12) {

System.out.println(input + " is Invalid input");

System.exit(0);

}

// 0 is assigned to checkSum

int checkSum = 0;

// for loop that goes through the string and does the computation

for (int i = 0; i < input.length(); i++) {

// if the index is even

if ((i + 1) % 2 == 0) {

checkSum += (input.charAt(i) - '0') * 3;

}

// if the index is odd

else

{

checkSum += input.charAt(i) - '0';

}

}

// modulo 10 of checkSum is assigned to checkSum

checkSum %= 10;

// checkSum is substracted from 10

checkSum = 10 - checkSum;

// if checkSum equals 10, 0 is concatenated with input

// else input is concatenated with checkSum

if (checkSum == 10) input += "0";

else input += checkSum;

// the new value of the isbn-13 is displayed

System.out.println("The ISBN-13 number is " + input);

}

}

Explanation:

The program is written in Java and well commented.

A sample of program output during execution is also attached.

You might be interested in
You just realized the turn signal on your vehicle is broken,
zimovet [89]

Answer:

c

Explanation:

7 0
4 years ago
Windows uses a memory-management technique known as ________ to monitor which applications you frequently use and preloads them
ad-work [718]
Windows uses a memory-management technique known as SuperFetch to monitor which applications you frequently use and preloads them into your system memory.
This technique is designed to speed up app launching by preloading certain apps based on the usage patterns of the user.

4 0
3 years ago
Background information
Ber [7]
Well I guess no breathing for you lol
6 0
3 years ago
Read 2 more answers
C programming:
Naddika [18.5K]
If( kidAge >=13 && KidAge <= 19)
    isTeenager=true;
3 0
3 years ago
Is www part of every url address?
melisa1 [442]
The correct answer is that WWW. is universal, meaning that any and all url addresses start and have www.

My reasoning is that if you were to look up, lets say google, do :

www.(google).com ( remove parentheses )

then

google.com 

You come up with the same results THUS YOUR CORRECT ANSWER IS YES! ALL URL ADDRESS HAVE AND CONTAIN WWW.!!!

5 0
4 years ago
Other questions:
  • On January 1, 1980, Moises deposited $1850 into a savings account paying 5.6% interest, compounded quarterly. If he hasn't made
    9·2 answers
  • Determine the number of bytes necessary to store an uncompressed binary image of size 4000 × 3000 pixels.
    9·1 answer
  • The Accounting department is testing a new payroll system server. To facilitate their tests, they would like to add the server t
    13·1 answer
  • Values that are sent into a function are called _________.<br><br> Program Output
    7·1 answer
  • What is the lucky 3 digit today
    12·1 answer
  • One of the ways attackers can access unencrypted data being transmitted on your network is by
    10·1 answer
  • How many bits would be used to count the students in class today?There are 10 students
    14·2 answers
  • Which of the following is time-dependant? Group of answer choices
    8·1 answer
  • Which of the following is the best example of an installation issue
    11·2 answers
  • What are the risks associated with this kind of connectivity?.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!