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(;   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;

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
        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
            return true;
      return false;

can anyone help me to getting this code closer to being completed? Thanks a lot!

Edited 3 Years Ago by mike_2000_17: Fixed formatting

use code tags to make your code more readable, then people will be more interested in looking through your code.

This article has been dead for over six months. Start a new discussion instead.