The example given is for number how can i change it to letters? Our assignment is pretty simple but i can't find it on the book. Im stuck
“Read” in characters and display the character until the “z” character is entered (“read”)
/* Guess a number between 1 and 10 Anderson, Franceschi */ import java.util.Random; import java.util.Scanner; public class GuessANumber { public static void main( String [ ] args ) { Random random = new Random( ); int secretNumber = random.nextInt( 10 ) + 1; Scanner scan = new Scanner( System.in ); System.out.print( "I'm thinking of a number" + " between 1 and 10. What is your guess? " ); int guess = scan.nextInt( ); if ( guess < 1 || guess > 10 ) { System.out.println( "Well, if you're not going to try," + " I'm not playing." ); } else { if ( guess == secretNumber ) System.out.println( "Hoorah. You win!" ); else { System.out.println( "The number was " + secretNumber ); if ( Math.abs( guess - secretNumber ) > 3 ) System.out.println( "You missed it by a mile!" ); else System.out.println( "You were close." ); System.out.println( "Better luck next time." ); } } } }