This is a program that I have to submit tomorrow please help. Thanks.
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.
This is a program that I have to submit tomorrow please help. Thanks.
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.
Todd W (August 20th, 2012)
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.
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);
}
}
I need help with figuring out the error in my program.
Todd W (August 20th, 2012)