HEEELLLOOOOOOOOOOOOOO!!! I am sorry. Was that too loud? Was I suppose to whisper? I don't know. I'm new. Anyway I need help this semester so I hope you guys bear with me. I have a horrible teacher and is making me lose interest as I typing. Hopefully you guys can help.
Basically what I am trying to to is adding numbers in a
string that the user inputs.
Here's my exercise:
I am trying to calculate the checksum for an ISBN number. There's more into the formula than what the program below has, but that isn't the problem. The problem is dissecting each individual number the user inputs so it will represent d1,d2,d3,d4 and then fit into the formula.
Here's what I have so far...
import java.util.Scanner;
public class ISBNExercise {
public static void main(String[] args) {
//Create a Scanner
Scanner input = new Scanner(System.in);
System.out.printf("Enter the first 9 numbers of an ISBN: ");
int firstNumbers = input.nextInt();
//int calcFirstNumbers = (d1 * 10 + d2 * 9 + d3 * 8 + d4 * 7 + d5 * 6 + d6 * 5 + d7 * 4 + d8 * 3 + d9 * 2);
//System.out.println("Adding the first 9 numbers equals to: " + calcFirstNumbers);
System.out.print("Your 10-digit ISBN Number is: " + firstNumbers);
}
}
I appreciate the help! Thanks!