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
Amy uses digital devices to listen to music and to watch movies. Which one of these is Mbps a measure of?
posledela

Answer:

Storage Size

Explanation:

the answer to which is better 8 Mbps or 2 MBps? Is 2 MBps (which is 16 Mbps). Using a less common, but more clear notation: which is better 8 Mbit/s or 2 MBps? Answer: 2 MBps, since that is 16 Mbit/s. (Marketing people use this confusion to their advantage if you're not sure which is intended, ask.)

Source http://cs.sru.edu/~mullins/cpsc100book/module02_introduction/module02-05_introduction.html

(if you want to read the full artical.)

8 0
2 years ago
Keith has to carry out a photo shoot to capture images of the ocean during the monsoons. What is a recommended practice when sho
Semmy [17]

Answer:

Answer is A: place absorbent chemical packets in the camera cover

Explanation:

Keith is required to carry adequate gear while going for a shoot. And in this case, he should carry anything that will protect his camera from the ocean and rainwater. By anything, I mean anything that Keith will use to stay dry. Using an air conditioner would be the worst idea. An air conditioner might blow the air towards your camera. Placing the camera in its case will ensure that it is dry and Keith will keep on shooting. Placing absorbent chemical packets in the camera cover will ensure that any water droplets that might fall on the cover of the camera will be absorbed. The point here is to keep dry.

6 0
3 years ago
A linear gradient can be positioned from left to right, top to bottom, or on any angle?
Harman [31]

from left to right because it is used more in expressions

3 0
2 years ago
Which bitwise operation has the same effect as multiplying a by 16?
Shalnov [3]
<span>Jun 15, 2011 - Multiplication and division can be achieved using bit operators, for example .... I discovered pretty much the same thing for Sun CC close to 20 years ago. ... Just to add a rough estimation: On a typical 16-Bit processor ..... Doing it yourself willaffect readability and possibly have no effect on performance.</span><span>
</span>
4 0
2 years ago
Read 2 more answers
29
denis23 [38]

The correct answer is A it transfers control to the next loop in the program.


The most valid answer is that the break statement Exits the loop and continues executing the program, but assuming that there are other loops, the control of the program will go to them since the first loop is broken out of.


3 0
3 years ago
Other questions:
  • To instruct Oracle11 g to sort data in ascending order, enter ____ after the column name in the ORDER BY clause.
    15·2 answers
  • Write a Python 3 script in PyCharm that will simulate the game of "Rock, Paper, Scissors": Display a header and the simple rules
    8·1 answer
  • When classified data is sent over an unclassified network, what is this incident called?
    5·1 answer
  • May someone type this down below just like how it is shown in the picture.
    7·1 answer
  • Several NEC® sections contain the requirement to size conductors and overcurrent devices at 100 percent of the noncontinuous loa
    15·1 answer
  • Discuss the impact printer and its types in detail?
    7·1 answer
  • Rideshare companies like Uber or Lyft track the x,y coordinates of drivers and customers on a map. If a customer requests a ride
    5·1 answer
  • What is the difference between a crosstab query and a subquery?
    11·2 answers
  • 5. An external CSS file is saved with D. Answer the following questions. 1. Explain the purpose and advantages of using CSS.​
    7·1 answer
  • which is a correct procedural step for a webpage to render on a user's browser? an information request is sent to an ip address
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!