title: Java-How to translate a String to piglatin?
body: <p>I am writing a pig latin code and I am tripped up by how to get my program to identify where the next vowel in the word is if the first letter in the word is a consonant. Then it moves the first part of the word, up to the first vowel, to the end of the word and prints ay along with it. (ex. trees = eestray)</p>
  
  <p>This is the code I have now</p>
  
  <pre><code>// word is bringing in the string entered from the user
  public static void translate(String word) {
  
      String wordCap, pigLatin = "";
      char vowels;
      int lowest = 0, tempOne, tempTwo, tempThree, tempFour, tempFive;  
  
      wordCap = word.toUpperCase();
      vowels = wordCap.charAt(0);
  
      if (vowels == 'A' || vowels == 'E' || vowels == 'I' || vowels == 'O' || vowels == 'U') {
              word = word + "way";
              System.out.println(word);
          }
          else {
              tempOne = wordCap.indexOf('A', 1);
              if (lowest &gt; tempOne &amp;&amp; tempOne != -1) {
                  lowest = tempOne;
              }
              tempTwo = wordCap.indexOf('E', 1);
              if (lowest &gt; tempTwo &amp;&amp; tempTwo != -1) {
                  lowest = tempTwo;
              }
              tempThree = wordCap.indexOf('I', 1);
              if (lowest &gt; tempThree &amp;&amp; tempThree != -1) {
                  lowest = tempThree;
              }
              tempFour = wordCap.indexOf('O', 1);
              if (lowest &gt; tempFour &amp;&amp; tempFour != -1) {
                  lowest = tempFour;
              }
              tempFive = wordCap.indexOf('U', 1);
              if (lowest &gt; tempFive &amp;&amp; tempFive != -1) {
                  lowest = tempFive;
              }
  
  
  
  
  public static char vowel(String word) {
      int start= 0, end= 0;
      char vowels;
  
      for (int i = 0; i &lt; word.length(); i++) {
          vowels = word.charAt(i);
          if (vowels == 'A' || vowels == 'E' || vowels == 'I' || vowels == 'O' || vowels == 'U') {
              end = i;
              break;
          }
      }
      return (char) end;
  }
  </code></pre>
  
  <p>(in translate method)</p>
  
  <pre><code>for (int i = 0; i&lt;wordCap.length(); i++) {
          if (vowel(wordCap.charAt(i))) {
              vowels = wordCap.charAt(i);
          }
  
      }
  </code></pre>
  
  <p>The problem now is that the vowel method is not an applicable method type. It says it must be a char?</p>