Something like that. Only you need to assign the value that returns to a variable.
See, I told you you knew it.
18 Replies - 8827 Views - Last Post: 15 July 2012 - 12:38 AM
#17
Re: Pig Latin problem.
Posted 15 July 2012 - 12:31 AM
jon.kiparsky, on 15 July 2012 - 12:28 AM, said:
Something like that. Only you need to assign the value that returns to a variable.
See, I told you you knew it.
See, I told you you knew it.
Please pardon my slang... but LOL.
Thanks for the help again. Also I think I may have figured out another way. I get one logical error which shows my newLname outputs incorrectly
String fname = "john";
String lname = "smith";
fname.toLowerCase();
lname.toLowerCase();
String newFname = fname.substring(1) + fname.charAt(0) + "ay";
String newLname = lname.substring(1) + lname.charAt(0) + "ay";
String updateFname = newFname.substring(0,1);
String updateLname = newLname.substring(0,1);
updateFname = updateFname.toUpperCase();
updateLname = updateLname.toUpperCase();
newFname = updateFname + newFname.substring(1);
newLname = updateLname = newLname.substring(1);
System.out.println("Your Pig Latin name is: ");
System.out.println(newFname + " " + newLname);
#18
Re: Pig Latin problem.
Posted 15 July 2012 - 12:35 AM
Yep, that looks okay from here.
Could quibble, but I'm sure there are some who will do it for me. For now, as long as it passes your test cases (you do test your code, I hope?) it's probably okay.
Could quibble, but I'm sure there are some who will do it for me. For now, as long as it passes your test cases (you do test your code, I hope?) it's probably okay.
#19
Re: Pig Latin problem.
Posted 15 July 2012 - 12:38 AM
jon.kiparsky, on 15 July 2012 - 12:35 AM, said:
Yep, that looks okay from here.
Could quibble, but I'm sure there are some who will do it for me. For now, as long as it passes your test cases (you do test your code, I hope?) it's probably okay.
Could quibble, but I'm sure there are some who will do it for me. For now, as long as it passes your test cases (you do test your code, I hope?) it's probably okay.
One of my friend helped me figure out what the error was. I fixed it and now it works fine.
//newLname = updateLname = newLname.substring(1); // the line above is incorrect and it should be newLname = updateLname + newLname.substring(1);

New Topic/Question
Reply



MultiQuote


|