Question: In Java, answer the following problem. Write a Java program that will prompt users for persons last name, year of birth, and employee number in

In Java, answer the following problem. Write a Java program that will prompt users for persons last name, year of birth, and employee number in a predefined specific format. Then it will need to parse the input string and print it in separate lines along with validations.

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

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

Last name Year of birth Employee number

The 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 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.

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

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!