How to change a Java Programming construct?

I have a ConstructID that is part of a program that constructs an ID using name and address, but what if someone's address begins with a letter instead of the numbers? My address starts W7935, which would make my ID SWLW793 instead of the SWL7935.

Is there a way to program it for the different addresses that start with a letter and for some addresses that dont start with a letter?

The output looks like this:

First, you're prompted for your first name.
George

Second, you're prompted for your middle name
Albert

Third, you're prompted for your last name
Lopez

Fourth, you're prompted for your street address.
123 Main Street

Lastly, the id of GAL 123 is assigned.

How do I get a letter to show up for an address
where the number is?

Then, an id is assigned.

Here is the code:

import javax.swing.*;
public class ConstructID
{
      public static void main(String [] args)
      {
        String firstName = "";
        String middleName = "";
        String lastName = "";
        String address = "";
            
            firstName = JOptionPane.showInputDialog(null,
                  "Please enter your first name");
            while(firstName.equals(""))
                  {
                  firstName = JOptionPane.showInputDialog(null,
                        "Please re-enter your first name");
                  }      
            middleName = JOptionPane.showInputDialog(null,
                  "Please enter your middle name");
            lastName = JOptionPane.showInputDialog(null,
                  "Please enter your last name");
                        while(lastName.equals(""))
                  {
                  lastName = JOptionPane.showInputDialog(null,
                        "Please re-enter your last name");
                  }
            address = JOptionPane.showInputDialog(null,
                  "Please enter your address");
                        while(address.equals(""))
                  {
                  address = JOptionPane.showInputDialog(null,
                        "Please re-enter your address");
                  }
            firstName = firstName.toUpperCase();
            middleName = middleName.toUpperCase();
            lastName = lastName.toUpperCase();
            
            
      JOptionPane.showMessageDialog(null, "Your ID is " +
            firstName.substring(0,1) + middleName.substring(0,1) +
            lastName.substring(0,1) + address.substring(0,4));
            
      }
}
Break40Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pramod KumarCommented:
You may check a character, if it is an alphabet or not:

String name = "Pramod123";

if (Character.isLetter(name.charAt(5)))
{
      System.out.println("The fifth character is an alphabet!");
}
else
{
      System.out.println("The fifth character is NOT an alphabet!");
}

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.