Whats wrong with this Pig Latin code?
heres my code so far...
Code java:
import java.util.StringTokenizer;
public class Piglatin{
public void processLine (Strin line){
StringTokenizer str = new StringTokenizer(line);
while (str.hasMoreTokens()){
String token = str.nextToken();
String pigToken = this.pigConvert(token);
finalPigLatinString += " " + pigToken;
}
System.out.println(finalPigLatinString);
}
public String pigConvert(Strign inputToken){
//this will convert my token to a pig token
char firstChar = inputString.charAt[0];
if (isVowel(firstChar)){
t += token + "ay ";
// just add 'way' to the word
}
else{
t += token.substring(1,token.length())+firstChar.toString().toLowerCase()+"ay ";
}
}
public boolean isVowel (char c){
//takes in a char and returns true if it is a vowel and returns false if it is not
if(someChar=='a'||someChar=='e'||someChar=='i'||someChar=='o'||someChar=='u'
||someChar=='A'||someChar=='E'||someChar=='I'||someChar=='O'||someChar=='U')
{
return true;
}
else
return false;
}
}
Re: Whats wrong with this Pig Latin code?
Please don't post duplicate threads. I've deleted your other one.
Re: Whats wrong with this Pig Latin code?
Also, see my signature on asking questions the smart way. You can't simply dump your code here without an explanation and hope for help- what's the problem? Post an SSCCE along with any exceptions or unwanted behaviors you're getting, and we'll go from there. Be specific.