title: How do you fix this code so that if the user inputs an uppercase or lowercase letter, as long as its the right letter, they'll be told its index:
body: <p>In this code, the user gets 3 guesses of letters in the name and then the user can guess the actual name. Does anybody know how to fix this code so that if the user enters &quot;m&quot; they'll still be told where its position is even though the name starts with a capital M?</p>
  <pre><code>//import java scanner
  import java.util.Scanner;
  
  //declare variables
  class Main 
  {
    Scanner scan = new Scanner(System.in);
    String name = &quot;Matt&quot;;
    String guessedName;
    int nameLength, position, guesses;
    char guess;
    
    //method for guessLetter
    public void guessLetter()
    { 
      nameLength = name.length();
      System.out.println(&quot;The name I am thinking of is &quot; + nameLength + &quot; letters long.\nYou will be able to pick three letters and I'll let you know the location  letter occurs in the name. Then you can guess the name.&quot;);
      guesses = 3;
      while(guesses &gt;= 1)
      {
        System.out.println(&quot;Guess one letter?&quot;);
        guess = scan.nextLine().charAt(0);
        letters();
        guesses -= 1;
      }
    
    }
  
    //method for guess Name
    public void guessedName()
    {
      System.out.println(&quot;Guess what you think the name is?&quot;);
      guessedName = scan.nextLine();
      if(guessedName.equalsIgnoreCase(name)){
        System.out.println(&quot;Correct, that is the name!&quot;);
      }
      else{
        System.out.println(&quot;Wrong, that is not the correct name.&quot;);
        System.out.println(&quot;The name is &quot; + name + &quot;.&quot;);
      }
    }
  
    //method for letters
    public void letters()
    {
      if(name.indexOf(guess)&gt;-1)
      {
        position = name.indexOf(guess);
        System.out.println(guess + &quot; is at position &quot; + position + &quot;.&quot;);
      }
      else
      {
        System.out.println(guess + &quot; is not in the name!&quot;);
      }
    }
  
    
    public static void main(String[] args) 
    {
      Main prog = new Main ();
      prog.guessLetter();
      prog.guessedName();
    }
  }
  </code></pre>