[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Missing post? - see this post about spam for more information.
Creating a slang translator  XML
Forum Index » GUI Development
Author Message
TFG

Newbie

Joined: 07/27/2011 17:35:13
Messages: 1
Offline

Hi,

I recently had a friends son ( that is learning java on his own) ask me to create a simple sample urban slang translator, and since its been a few years since Ive messed around with java I am running into a problem. If my memory serves me correct I remember spending hours on a project only to realize all the problems I had were something silly. Anyhow, It seems I have gotten close except that my main problem is a big one, I cant seem to get the results returned. Since he only wants to screw around with turning an application into an app saving me some hours or days would be greatly appreciated. Im sure there is an easier way, but since I've came this far now I am the curious one. Here is where I'm at thus far.

import java.util.Scanner;
import java.awt.*;
import java.util.*;

public class Slang
{
public static void main(String[] args)
{
String[][] translateList = {{"a long time", "a minute"},
{"opinion", "two cents" },
{"dance", "two step"},
{"attractive", "all that"},
{"leave", "audi"},
{"yes", "awe yeah"},
{"no", "awe naw"},
};
Scanner scan = new Scanner(System.in);
System.out.println ( "convert it to slang" );
String sentence = scan.nextLine();
String[] input = sentence.split("\\s");

for (int x=0; x<input.length; x++)
{
for (int y = 0; y < translateList.length; y++)
if (input[x].equalsIgnoreCase(translateList[y][0]))
System.out.println("True");
}
}
}
 
Forum Index » GUI Development
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2012 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle