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
Usimov [2.4K]
3 years ago
9

for java ?(Business: check ISBN-13)ISBN-13 is a new standard for identifying books. It uses 13 digits d1d2d3d4d5d6d7d8d9d10d11d1

2d13. The last digit d13 is a checksum, which is calculated from the other digits using the following formula:10 - (d1 + 3d2 + d3 + 3d4 + d5 + 3d6 + d7 + 3d8 + d9 + 3d10 + d11 + 3d12) % 10If the checksum is 10, replace it with 0. Your program should read the input as a string.Display "invalid input" if the input is incorrect.Sample Run 1Enter the first 12 digits of an ISBN-13 as a string: 978013213080The ISBN-13 number is 9780132130806Sample Run 2Enter the first 12 digits of an ISBN-13 as a string: 978013213079The ISBN-13 number is 9780132130790Sample Run 3Enter the first 12 digits of an ISBN-13 as a string: 9780132097801320 is an invalid inputClass Name: Exercise05_47
Computers and Technology
1 answer:
ludmilkaskok [199]3 years ago
6 0

Answer:

In Java:

import java.util.*;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 String isbn;

 System.out.print("First 1:2 digits: ");

 isbn = input.nextLine();

 if(isbn.length()==12){

 int chksum = 0;

 for(int i = 0; i<12;i++){

     if((i+1)%2==0){      chksum+= 3 * Character.getNumericValue(isbn.charAt(i));          }

     else{          chksum+=Character.getNumericValue(isbn.charAt(i));          }  }

 chksum%=10;

 chksum=10-chksum;

 if(chksum==10){

 System.out.print("The ISBN-13 number is "+isbn+"0");}

 else{

 System.out.print("The ISBN-13 number is "+isbn+""+chksum);          }   }

 else{

     System.out.print("Invalid Input");

 }     }}

Explanation:

See attachment for explanation where comments are used to explain each line

Download txt
You might be interested in
As a consommé simmers, the meat and eggs coagulate, forming a
victus00 [196]

raft confirmed and correct

7 0
3 years ago
A motherboard has four DIMM slots; three slots are gray and the fourth is black. What type of memory is this board designed to u
rodikova [14]

Answer:

A motherboard will require DDR3 type of memory.

Explanation:

In the motherboard, we use DDR3 RAM. It stands for "Double Data Rate 3" full name of this ram is DDR3 SDRAM where SDRAM stands for "Synchronous Dynamic Random-Access Memory". It was firstly implemented in the 1970s.

  • DRAM is not clock-controlled.
  • The DRAM is asynchronous RAM i.e. with no Synchronous replication of external stimulus.
6 0
3 years ago
What is a cpu in full explanation?
diamong [38]

Explanation:

The computer's central processing unit (CPU) is the portion of a computer that retrieves and executes instructions. The CPU is essentially the brain of a CAD system. It consists of an arithmetic and logic unit (ALU), a control unit, and various registers. The CPU is often simply referred to as the processor.

8 0
3 years ago
Read 2 more answers
Identify the four basic categories of hardware in a personal computer system
Pie
The four basic categories are the motherboard, the CPU, the graphics card, and the RAM.
Brainliest pls! thx! :)
5 0
3 years ago
An asymmetric encryption system utilizes how many keys?
ivanzaharov [21]
Two. One for encryption, and one for decryption. RSA is an example of an asymmetric encryption algorithm.
7 0
3 years ago
Other questions:
  • Suppose the program counter (pc) is set to 0x2000 0000. is it possible to use the jump (j) mips assembly instruction to set the
    15·1 answer
  • This measures how close a biometric reading is to a prerecorded template
    11·1 answer
  • Write a method called makeLine. The method receives an int parameter that is guaranteed not to be negative and a character. The
    11·1 answer
  • Henry uses a laptop and has noticed that sometimes when he is typing, the cursor will move, causing him to mistype words or even
    12·1 answer
  • Password is an example of an authentication mechanisms that is based on " what an entity has".
    6·2 answers
  • Retype and run, note incorrect behavior. Then fix errors in the code, which should print num_stars asterisks.
    9·1 answer
  • Write a program that uses a dictionary to store students birthdays. Your program should ask the user what their name is, and loo
    11·1 answer
  • Sharl downloads images from an online library and uses them in her work. The images are shared under the Creative Commons Attrib
    13·1 answer
  • c++ 4.17 LAB: Count characters Write a program whose input is a character and a string, and whose output indicates the number of
    14·1 answer
  • A type of attack where the adversary intercepts network packets, modifies them, and inserts them back into the network is called
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!