0

This is not a duplicate of "Writing a Java program that converts an English word into Pig Latin". I have checked that and it doesn't help...

The difference between my problem and the other questions/answers here on stack overflow is the fact that I have to have a specific program that returns the Pig Latin to the compiler that grades me if I'm correct or not. Even using the other questions, the compiler doesn't accept the code even when altered. The code just needs to be more specific in how it executes the code. I am new to java, and I still don't quite understand everything that is going on.

I need to convert any input given to Pig Latin.I have looked at the other questions on converting to pig latin on this site, but they still don't help me. Here is the problem...


Your job is to translate English input to Pig Latin output. For this exercise, keep capitalized letters capitalized, even when they are moved.

ID: piglatin1

Input: A sentence in English.

Output: The translation in Pig Latin.


The code I have (It isn't much because I don't really know where to start):

import java.util.Scanner;
 public class program /* needs to be named this for compiler */
   {
       public static void main(String[] args)
      {
         Scanner pig = new Scanner(System.in);
         String word = piglatin1;
      };
   };

How would I do this?

  • 1
    Heh this is a actually a pretty cool homework problem. Do you have some code to show us? – maxshuty Nov 05 '15 at 14:21
  • why did the other questions not help you? Whats the difference to your problem? – Rhayene Nov 05 '15 at 14:22
  • @Rhayene Mine is run in a compiler that needs a specific output. I will update the question – Katherine Gerot Nov 05 '15 at 14:23
  • 1
    @Max Poshusta I will add it to the question – Katherine Gerot Nov 05 '15 at 14:23
  • My question is not a duplicate as I stated above – Katherine Gerot Nov 05 '15 at 14:36
  • 1
    first you have to chop your task in small chunks: 1. input of the word (work on this until it works) look at this question for that part: http://stackoverflow.com/questions/11871520/how-can-i-read-input-from-the-console-using-the-scanner-class-in-java 2. translate the given word - the first answer here is quite understandable: http://stackoverflow.com/questions/22417184/how-to-translate-english-into-piglatin-with-java-using-boolean-and-string - if that does not help you, tell us why – Rhayene Nov 05 '15 at 14:41
  • what is the expected output - can you give an example? – Rhayene Nov 05 '15 at 14:54
  • Hello World - elloHay orldWay – Katherine Gerot Nov 05 '15 at 15:14
  • Only the pig latin needs to be returned and not printed out. – Katherine Gerot Nov 05 '15 at 15:14
  • so you don't use the main method? btw its hard to understand the specific system you are running in - maybe a teacher or fellow student is able to provide you better help. you normally return a value with the `return`keyWord – Rhayene Nov 05 '15 at 15:20
  • It appears to me that "piglatin1" should be the name of the class. The input comes from System.in, and the output goes to System.out.println. The code in your piglatin1 class can contain any number of methods, as long as you have a main method for the grader process to execute. – Gilbert Le Blanc Nov 05 '15 at 15:55

0 Answers0