so my assignment is:
For this assignment, your job is to create a program that reads in multiple lines of text, and then produces the translation of that text into the English language variant known as "pig latin". Pig latin works this way: if a word begins with a vowel (a-e-i-o-u), then "ay" is added to the end of the word (so "idle" -> "idleay", and "often" -> "oftenay"); on the other hand, if a word begins with a consonant, then the first letter is removed, and is placed at the end of the word, followed by "ay" (so "month" -> "onthmay", and "castle" -> "astlecay").
Your program, then, should read in multiple lines of text, ending finally with two carriage returns. After the reading segment ends, your program should then print the pig latin translation of the input text. As a simplification, report the translation with no punctuation, and in all lower case.
Below we give you the driver (the PigDriver class). Your job is to write the Piglatin class so that PigDriver works appropriately.
[import java.util.*;public class PigDriver{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); String t = " "; Piglatin p = new Piglatin(); while(t.length() > 0){ t = scan.nextLine(); t = t.toLowerCase(); p.pigConvert(t); } p.pigReport(); }} ]
my code to this point is:
[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;
}
}
]
can anyone help me to getting this code closer to being completed? Thanks a lot!