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
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
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started