I need to write a program that translates english words to pig latin..
Here's how to translate the English word into the Pig Latin word.
If there are no vowels in the English word, then the Pig Latin word is just the English word + "ay." (There are 10 vowels: 'a,' 'e,' 'i,' 'o,' and 'u,' and their upper-case counterparts.)
Else, if the English word begins with a vowel, then the Pig Latin word is just the English word + "yay."
Otherwise (if the English word has a vowel in it and yet doesn't start with a vowel), then the Pig Latin word is end + start + "ay," where end and start are defined as follows.
Let start be all of the English word up to (but not including) its first vowel.
Let end be all of the English word from its first vowel on.
But, if the English word is capitalized, then capitalize end and "uncapitalize" start.
well i still ONLY have this
import java.util.Scanner;
public class Piglatinator
{
public static void main(String [] args)
{
System.out.println("Welcome to the Piglatinator Translator!");
String str, another = "y";
char vowel[]={'a','e','u','o','i'};
Scanner scan = new Scanner(System.in);
while(another.equalsIgnoreCase("y"))
{
System.out.println("Enter an English phrase: ");
str = scan.nextLine();
int a=0;
System.out.println();
for(int i=0;i<str.length();i++)
{
a=i+1;
if(str.charAt(i)==' ')
{
for(int j=0;i<vowel.length;j++){
if(str.charAt(a)==vowel[j])
str.charAt(a);
}
}
}
System.out.println("Right another message(y/q)? ");
another = scan.nextLine();
}
}
}

New Topic/Question
Reply




MultiQuote




|