I'm new here and very new to programming. I am actually taking a Intro to Programming in Java course right now and my teacher isn't super helpful so I would just like to have other people help me out with this. Anything will be appreciated. My program is designed to generate ISBN-10 numbers based on what the user enters into the console. the user enters 9 numbers in the console. What I am trying to have the program do is measure the length of the characters entered and if it does not equal nine then it will say "You must enter 9 numbers". Here's what I have:
Scanner input = new Scanner(System.in);
System.out.println("Enter 'C' for console generation of an ISBN, or 'R' for a random generation of an ISBN:");
String letter = input.next().toLowerCase();
if (letter==c) {
System.out.println("Enter the first 9 digits of an ISBN:");
int d1 = input.nextInt();
int d2 = input.nextInt();
int d3 = input.nextInt();
int d4 = input.nextInt();
int d5 = input.nextInt();
int d6 = input.nextInt();
int d7 = input.nextInt();
int d8 = input.nextInt();
int d9 = input.nextInt();
int numbers = (d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9);
int d10 = (d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) % 11;
if (d10 == 10) {
System.out.println("Console generated ISBN-10 is " + d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + "X");
}
else if (numbers.length() != 9) {
System.out.println("You need to enter exactly 9 digits");
System.exit(2);
}
Any help is appreciated thank you!!!