Write a program that starts with the string variable first set to your first name and the string variable last set to your last name. Both names should be all lowercase. Your program should then create a new string that contains your full name in pig latin with the first letter capitalized for the first and last name. Use only the pig latin rule of moving the first letter to the end of the word and adding “ay”. Output the pig latin name to the screen. Use the substring and toUpperCase methods to construct the new name. For example, given
first= “walt”;
last=”savitch”;
the program should create a new string with the text “Altway Avitchsay” and print it.
I know I am missing something here to pull it all together. The problem is, I do not understand enough to know what is missing and how to further investigate how to fix it. I will gladly take any help, no matter how minimal it may be--I just need help getting on track.
import java.util.Scanner;
public class PigLatin
{
public static void main(String[] args)
{
System.out.println("Bob Marley in Pig Latin is...");
String first = "bob";
String last = "marley";
first.substring(1, 2);
last.substring(1, 5);
String fullname = first + "bay" + last + "may";
fullname.toUpperCase(0);
fullname.toUpperCase(5);
System.out.println(fullname);
}
}

New Topic/Question
Reply



MultiQuote





|