Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Wap to accept a word and display its equivalent pig latin word.Eg. Hello to ifmmp.

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    4
    My Mood
    Starving
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Wap to accept a word and display its equivalent pig latin word.Eg. Hello to ifmmp.

    This is a program that I have to submit tomorrow please help. Thanks.


  2. #2
    Member
    Join Date
    Jun 2012
    Location
    Left Coast, USA
    Posts
    451
    My Mood
    Mellow
    Thanks
    1
    Thanked 97 Times in 88 Posts

    Default Re: Wap to accept a word and display its equivalent pig latin word.Eg. Hello to ifmmp

    Quote Originally Posted by Todd W View Post
    ...please help...
    What the heck is Wap. Does that refer to "Write a program"? Or what? (Reminds me of those "wap-wap-wap-wap" sounds that the Highway Patrol helicopters make every time they chase me.)

    Anyhow...

    What kind of help would you like with your Wap assignment? What have you done so far?


    Cheers!

    Z
    Last edited by Zaphod_b; August 19th, 2012 at 02:45 PM.

  3. The Following User Says Thank You to Zaphod_b For This Useful Post:

    Todd W (August 20th, 2012)

  4. #3
    Junior Member
    Join Date
    Aug 2012
    Posts
    4
    My Mood
    Starving
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Wap to accept a word and display its equivalent pig latin word.Eg. Hello to ifmmp

    Wap is actually Write a program, sorry about that. We basically have to display the pig latin version of any word accepted from the user like if the user wants to display the word Hello in pig latin form then the output would be ifmmp. I figured out that in the english alphabet if you take the H from Hello and the i from ifmmp then we can see that i comes after H. In the same manner the e in Hello comes before the f in ifmmp, the two l's in Hello come before the two m's in ifmmp and that the o in Hello comes before the p in ifmmp. So basically it from (H to i), (e to f), (l to m), (l to m) and (o to p). So basically it is from Hello to ifmmp.

  5. #4
    Junior Member
    Join Date
    Aug 2012
    Posts
    4
    My Mood
    Starving
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Wap to accept a word and display its equivalent pig latin word.Eg. Hello to ifmmp

    I tried the following program but then there is a problem when it comes to compiling the program:
    The error is that the compiler cannot find the variable outstr.


    /*
    * Write a program to accept a word and display its equivalent pig- latin word.
    * Hello
    * ifmmp
    */
    class piglatin
    {
    public static void main(String str)
    {
    for ( int i = 0;i < str.length(); i++)
    {
    char ch = str.charAt(i);
    ch ++;
    outstr = outstr + ch;
    }
    System.out.println("The equivalent pig- latin of " + str + " is" +outstr);
    }
    }

  6. #5
    Junior Member
    Join Date
    Aug 2012
    Posts
    4
    My Mood
    Starving
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Wap to accept a word and display its equivalent pig latin word.Eg. Hello to ifmmp

    I need help with figuring out the error in my program.

  7. #6
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Wap to accept a word and display its equivalent pig latin word.Eg. Hello to ifmmp

    Quote Originally Posted by Todd W View Post
    I need help with figuring out the error in my program.
    ok. here it is...
    Quote Originally Posted by Todd W View Post
    The error is that the compiler cannot find the variable outstr.
    You found it!!

    Now fix it. The variable needs to be declared before it can be used.

  8. The Following User Says Thank You to jps For This Useful Post:

    Todd W (August 20th, 2012)

Similar Threads

  1. how to catch the particular word?
    By sxlend in forum Java Theory & Questions
    Replies: 4
    Last Post: July 25th, 2012, 12:30 PM
  2. How to Create a Word Rectangle
    By Pettsa in forum Object Oriented Programming
    Replies: 34
    Last Post: June 4th, 2012, 12:31 AM
  3. read a file word by word
    By poornima2806 in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: February 23rd, 2012, 03:14 PM
  4. Reading a text file word by word
    By dylanka in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: October 21st, 2011, 02:06 PM
  5. Word Search Help
    By Tanner in forum What's Wrong With My Code?
    Replies: 1
    Last Post: June 3rd, 2011, 01:39 AM

Tags for this Thread