rendered paste bodyimport java.util.*;
import javax.swing.*;
/**
* Generates the user's 'Star Wars' name.
*
* @author Jono
* @version beta
*/
public class NameGenerator
{
private String firstName;
private String lastName;
private String starWarsName;
private String birthPlace;
private String maidenName;
private StringBuffer buffer;
public NameGenerator()
{
this.firstName = new String(JOptionPane.showInputDialog("Enter first name:"));
this.lastName = new String(JOptionPane.showInputDialog("Enter last name:"));
this.birthPlace = new String(JOptionPane.showInputDialog("Enter birth place:"));
this.maidenName = new String(JOptionPane.showInputDialog("Enter mother's maiden name:"));
generateStarWarsName();
}
public void generateStarWarsName()
{
starWarsName = new String();
starWarsName = lastName.substring(0, 1).toUpperCase();
starWarsName += lastName.substring(1, 3);
starWarsName += firstName.substring(0, 2);
starWarsName += " ";
starWarsName += maidenName.substring(0, 1).toUpperCase();
starWarsName += maidenName.substring(1, 2);
starWarsName += birthPlace.substring(0,3);
// buffer = new StringBuffer(starWarsName);
// buffer.replace(0, 0, buffer.charAt(0).toUpperCase());
JOptionPane.showMessageDialog(null, "Your Star Wars name is: " + starWarsName);
}
}