Question: In this programming assignment we will review string and character manipulations. You will be developing a Java program that will prompt users for persons last

In this programming assignment we will review string and character manipulations. You will be developing a Java program that will prompt users for persons last name, year of birth, and employee number in a predefined specific format. You will then parse the input string and print it in separate lines along with validations.

The input format will be of the form :,< employee number >

You will need to separate three segments in order to print it as:

Last name

Year of birth

Employee number

Your program will report if these values are Valid, or if they are Invalid.

Functional requirements:

1. A last name is valid if it contains only letters and spaces, it begins and ends with a letter, and it does not contain 2 consecutive spaces.

2. Valid birth years are integers between 1900 and 1999, inclusive, but your program must print Invalid on non-numeric input. Implicitly, this means you must read the data as a string.

3. Valid employee number will have the format LDDD-DD-DDDD, where L is a capital letter and each D is a digit. For example, A991-16-4602. Hint:

You will need to use at least the indexOf and substring methods.

Sample Run

Please enter an string as the form of :,< employee number >

Barford:1975,A123-45-6728

last name: Barford

Last Name is Valid

year of birth: 1975

Year of Birth is Valid

license number: A123-45-6728

Employee Number is Valid

Please enter an string as the form of :,< employee number >

Dyer Doan:2001,C123-11-7840

last name: Dyer Doan

Last Name is Valid

year of birth: 2001

Year of Birth is Invalid

employee number: C123-1178-40

Employee Number is Valid

Please enter an string as the form of :,< employee number >

Dy er:98,1135-4498-40

last name: Dy er

Last Name is Invalid

year of birth: 98

Year of Birth is Invalid

employee number: 1135-4498-40

Employee Number is Invalid

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!