Question: Work with Symbolic Constants (final), String parsing and manipulation. Star Wars names are created by taking the first three letters of your first name and

Work with Symbolic Constants (final), String parsing and manipulation.

Star Wars names are created by taking the first three letters of your first name and the first two letters of your last name to create your first name in Star Wars. Your last Star Wars name is created by taking the first two letters of your mothers maiden name and the first three letters of the city you were born in. I got this formula from the Internet so it MUST be true.

Start by creating the driver class StarWarsName. When running the class you will enter | (pipe) delimited data as a single Program Argument through main()) that will be used to generate you true identity in the form of a Star Wars name.

For example:

Brady|Mills|Shepherd|Chilliwack

The above will be split using the | delimiter into four Strings. Using the formula described above you will generate you Star Wars name.

Brady|Mills|Shepherd|Chilliwack becomes Brami Shchi.

NOTE: With the exception of the first letters of each name all letters are displayed in lower case.

Final notes:

You must use the String methods split(), substring() in your solution.

Symbolic constants should be used instead of magic numbers in your code.

Use System.out.format() to display your Star Wars name to the console.

The program should check to be sure data was entered on startup. If not then throw an IllegalArgumentException

The program should also make sure there are four Strings available before attempting to create the names. If not then report the error and exit with System.exit(-1);

Sample runs:

Work with Symbolic Constants (final), String parsing and manipulation. Star Wars names

Missing arg Exception in thread "main" java.lang. IllegalArgumentException: missing data input at StarWarsName.main(StarWarsName.java:26) Not four Strings: ERROR: incorrect number of words provided. Successful run: Your Star Wars name is: Brami Shchi

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!