I'm doing a project of If and else,This project requires you to take a user input, and then move the first letter of the word they entered to the last letter of the word. The problem is I don't know what the last number of the user is.
I want to use the substring method for this. I don't know how to move a letter from the beggining of the word to the last letter of the word , because I don't know what is the last letter of the word(the user can enter anything)
I started doing it but I have no progress at all, because I don't know what the last letter is of the users input.
import javax.swing.*;
public class PigLatinDriver {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String word = JOptionPane.showInputDialog("Enter the word to be translated into pig Latin.");
boolean consonant =false;
If(word.substring(0)== "b");{
word.substring(0).replace("b"," ");
}
if(consonant==true){
}
//perform the logic to translate to piglatin
//Words that begin with a consonant move the first letter to the end and then add ay
// vowels just add ay
// The exception being when you use the word "Small" with an upper case, then you make no change.
String translation = "";
JOptionPane.showMessageDialog(null, translation);
}
private static void If(boolean b) {
// TODO Auto-generated method stub
}
}